Exemplo n.º 1
0
 void Register(BehaviourType type, BaseBehaviour behaviour)
 {
     if (mBehaviours.ContainsKey(type))
     {
         return;
     }
     behaviour.mNPC = mNPC;
     mBehaviours.Add(type, behaviour);
 }
Exemplo n.º 2
0
        public void SetBehaviour(BehaviourType type)
        {
            BaseBehaviour b = null;

            if (!mBehaviours.TryGetValue(type, out b))
            {
                return;
            }
            BaseBehaviour lastBehaviour = mCurrentBehaviour;

            mCurrentBehaviour = b;
            if (lastBehaviour != null)
            {
                lastBehaviour.Exit();
            }
            if (mCurrentBehaviour != null)
            {
                mCurrentBehaviour.Enter();
            }
        }