예제 #1
0
 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));
 }
예제 #2
0
        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]--;
                }
            }
        }
예제 #3
0
        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]++;
                }
            }
        }
예제 #4
0
 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));
 }