public MonsterAI(Monster _monster) { monster = _monster; aiInfo = monster.aiInfo; anim = monster.gameObject.AddComponent <Animator> (); anim.runtimeAnimatorController = GameObject.Instantiate <RuntimeAnimatorController> (Resources.Load("AI/BaseAI") as RuntimeAnimatorController); //behaviourManager = new BehaviourManager (anim, this); }
public MonsterAI(Monster _monster) { monster = _monster; aiInfo = monster.aiInfo; anim = monster.gameObject.AddComponent <Animator> (); anim.runtimeAnimatorController = GameObject.Instantiate <RuntimeAnimatorController> (Resources.Load("AI/BaseAI") as RuntimeAnimatorController); behaviourManager = new BehaviourManager(anim, this); //Create dictionary of state names from state machines with the functions they will call, names must match stateNames above stateDict = new Dictionary <string, BaseState>(); stateDict.Add("Idle", new IdleState(monster)); stateDict.Add("Die", new DieState(monster)); stateDict.Add("AttackTarget", new AttackState(monster)); stateDict.Add("Enraged", new EnragedState(monster)); stateDict.Add("ChaseTarget", new ChaseState(monster)); stateDict.Add("Wander", new WanderState(monster)); stateDict.Add("Retreat", new RetreatState(monster)); }