private void MakeFSM() { WolfAIFSMState.moveSpeed = this.moveSpeed; WolfAIFSMState.visibleRadius = this.visibleRadius; WolfAIFSMState.attackRadius = this.attackRadius; fsm = new WolfAIFSMSystem(); if(pc == null) pc = GameObject.FindGameObjectWithTag("Player"); pc.GetComponent<ThirdPersonController>().enemyCount ++; WolfIdle idle = new WolfIdle(fsm, gameObject, pc); idle.AddTransition(WolfAITransition.FoundPlayer, WolfAIStateID.ChasePlayer); WolfChasePlayer chasePlayer = new WolfChasePlayer(fsm, gameObject, pc); chasePlayer.AddTransition(WolfAITransition.LostPlayer, WolfAIStateID.Idle); chasePlayer.AddTransition(WolfAITransition.ReachedPlayer, WolfAIStateID.AttackPlayer); WolfAttackPlayer attackPlayer = new WolfAttackPlayer(fsm, gameObject, pc); attackPlayer.AddTransition(WolfAITransition.PlayerRan, WolfAIStateID.ChasePlayer); attackPlayer.AddTransition(WolfAITransition.PlayerDead, WolfAIStateID.Idle); fsm.AddState(idle); fsm.AddState(chasePlayer); fsm.AddState(attackPlayer); }
public WolfChasePlayer(WolfAIFSMSystem fsm, GameObject npc, GameObject pc) { stateID = WolfAIStateID.ChasePlayer; this.npc = npc; this.pc = pc; pcScript = pc.GetComponent<ThirdPersonController>(); anim = npc.GetComponent<Animator>(); this.fsm = fsm; }
public WolfIdle(WolfAIFSMSystem fsm, GameObject npc, GameObject pc) { stateID = WolfAIStateID.Idle; this.npc = npc; this.pc = pc; this.fsm = fsm; anim = npc.GetComponent<Animator>(); }
public WolfAttackPlayer(WolfAIFSMSystem fsm, GameObject npc, GameObject pc) { stateID = WolfAIStateID.AttackPlayer; this.npc = npc; this.pc = pc; anim = npc.GetComponent<Animator>(); this.fsm = fsm; }