Exemple #1
0
 private void Start()
 {
     _isAttacking = false;
     _agent       = GetComponent <NavMeshAgent>();
     SetState(BossChargeTownState.GetInstance());
     _rb = GetComponent <Rigidbody>();
 }
 public static BossChargeTownState GetInstance()
 {
     if (_instance == null)
     {
         _instance = new BossChargeTownState();
     }
     return(_instance);
 }
 public override void Update(BossAgent agent)
 {
     agent.SetPlayerAsTarget();
     if (agent.GetIsPlayerInAttackRange())
     {
         agent.SetState(BossAttackState.GetInstance());
     }
     if (!agent.GetIsPlayerInRange())
     {
         agent.SetState(BossChargeTownState.GetInstance());
     }
 }
 public override void Update(BossAgent agent)
 {
     if (agent.GetIsPlayerInAttackRange())
     {
         agent.SetState(GetInstance());
     }
     else if (agent.GetIsPlayerInRange())
     {
         agent.SetState(BossFollowPlayerState.GetInstance());
     }
     else if (agent.GetIsBaseInAttackRange())
     {
         agent.SetState(GetInstance());
     }
     else
     {
         agent.SetState(BossChargeTownState.GetInstance());
     }
 }