public void AddBehavior(ABehavior beh) { if (_behaviors == null) { _behaviors = new List <ABehavior>(); } beh.GameObject = this; _behaviors.Add(beh); GameObjectManager.Get.AddBehavior(beh); SendMessage(new Message(ElementType.ALL, Traverses.SCENEROOT, Actions.BEHAVIOR_ADDED, SenderType.GAMEOBJECT, _id, beh)); }
public void RemoveBehavior(ABehavior beh) { allBehaviors.Remove(beh); foreach (var listenerKey in beh.MessageListeners.GetAllStates()) { if (behaviorListeners[listenerKey] == 1) { behaviorListeners.Remove(listenerKey); } else { behaviorListeners[listenerKey]--; } } }
public void AddBehavior(ABehavior beh) { allBehaviors.Add(beh); foreach (var behListener in beh.MessageListeners.GetAllStates()) { if (!behaviorListeners.ContainsKey(behListener)) { behaviorListeners.Add(behListener, 1); } else { behaviorListeners[behListener]++; } } }
public void RemoveBehavior(ABehavior beh) { _behaviors.Remove(beh); GameObjectManager.Get.RemoveBehavior(beh); SendMessage(new Message(ElementType.ALL, Traverses.SCENEROOT, Actions.BEHAVIOR_REMOVED, SenderType.GAMEOBJECT, _id, beh)); }