Tag Info

New answers tagged

0

It sounds like what you want is named delegates. If I understand it correctly, your actions are just a call to a function in an existing component. Then all you need is to store a member function pointer and a pointer to the component, instead of a custom class. You can do this directly with member function pointers, or wrap it in a delegate class. It would ...


1

If Component had a method ActOn(Character), you could simply call component.ActOn(this). Each subclass could implement appropriately. For example: Healing.ActOn(Character character) { Heal(character); }


0

There are a few ways to achieve this. First, you can use layers and modify the collision matrix so that it won't interact with non-collidable objects. Second, objects you want to collide can contain a common component to mark them as collidable. Let's say it's Reflectable. At run-time, you can determine whether the object is collidable or not with this: ...


0

A little late to the party here but thought I'd add a few suggestions and reasoning behind each which should be considered when considering these or other suggested answers mentioned in this thread. I've faced the same question and the answer always seems to be to decide which trade-offs best suit my particular situation. My suggestions are based on c# ...



Top 50 recent answers are included