void Register(BehaviourType type, BaseBehaviour behaviour) { if (mBehaviours.ContainsKey(type)) { return; } behaviour.mNPC = mNPC; mBehaviours.Add(type, behaviour); }
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(); } }