New answers tagged

0

One way to approach this is to have some facility for components that don't normally deal with movement to request of the appropriate that a movement occur. If you're using a message-passing approach to talk between components, you'd just fill out a RequestMovement message with information about the desired movement or animation and send it off, and the ...


5

Your communication model seems fine, and option one would work okay if only you could store those pointers safely. You can solve that problem by picking a different data structure for component storage. A std::vector<T> was a reasonable first choice. However, the container's iterator invalidation behavior is a problem. What you want is a data ...


5

Being 'cache friendly' is a preoccupation big games have. This seems to be premature optimization to me. One way to solve this without being 'cache friendly' would be to create your object on the heap instead of on the stack: use new and (smart)pointers for your objects. This way, you'll be able to reference your objects and their reference will not be ...


0

I'm going to try and write some example code using delegates since I think they might do what you want. Code is mostly taken from the delegate section of MSDN using UnityEngine; using System.Collections; namespace MyNamespace { public class ShowPoints : MonoBehaviour { public void showPoitsn() { Debug.Log("ShowingPoints"...



Top 50 recent answers are included