The polymorphism tag has no wiki summary.
1
vote
1answer
31 views
Unity polymorphism in editor through a list
So I have an ItemDatabase class which basically only has a list of Item
public class ItemDatabase : MonoBehaviour {
public List<Item> Items = new List<Item>();
}
The Item class ...
3
votes
0answers
147 views
Unity3D [C#]: How do I use a custom inspector to expose an array of polymorphic objects to edit?
[EDIT: based on some feedback, I pruned the example down to the base functionality of the bug we are trying to solve. The description below remains accurate, but the repro has been shortened to:
...
2
votes
1answer
293 views
Collision Shapes Abstraction Design
Straight to the facts.
I have a base CEntity class for different entities in my game:
Static entities ( those do not move, simply props and items )
Dynamic entities ( these move, jump )
Each of ...
0
votes
1answer
74 views
Interface or Class Inheritance [closed]
I am making an inventory system. Different inventory item will have different uses so i am thinking about making a base class called InventoryItem and derive Wood, Gold, Weapons and so on. This way ...
9
votes
3answers
455 views
Flexible alternatives to many many small polymorphic classes (for use as properties or messages or events) C++
There are two classes in my game that are really useful, but slowly becoming a pain. Message and Property (property is essentially a component).
They both derive from a base class and contain a ...
4
votes
4answers
664 views
Inheritance Hierarchy and Design — avoiding multiple inheritance
I am working on a 3D game, and need some advice about how to best design and structure my code so that I achieve what I'm going for without using bad practices like multiple inheritance.
Basically ...
0
votes
1answer
897 views
Creating an abstract Animation class
I'm creating a simple 2d game with c++ and SFML, and I've got a simple framework going for animating a sprite using a "SpriteSheet" image (an big image containing all the "frames" of an animation)
...
0
votes
1answer
354 views
Problem creating levels using inherited classes/polymorphism
I'm trying to write my level classes by having a base class that each level class inherits from...The base class uses pure virtual functions.
My base class is only going to be used as a vector ...
2
votes
2answers
126 views
How to handle similar actions in derived actors (inheritance)
I have a base class called Attacker that has a update method. The update method moves attacker through an array of waypoints as given below:
- (void) update:(ccTime)dt {
if(state == kMove) {
...
-6
votes
2answers
683 views
Component-based entities without IDs?
I'd like to know if someone has found a way to build a component-based entity system in their game(s) without using IDs. I find that IDs tend to do away with one of the major (possible) advantages of ...