コード例 #1
0
        public IState DoState(BatStateMachine stateMachine)
        {
            DoShooting(stateMachine);

            if (stateMachine.enemy.conditions.isDead)
            {
                return(stateMachine.deathState);
            }
            else if (stateMachine.enemy.conditions.isHitten)
            {
                return(stateMachine.getHitState);
            }
            else if (stateMachine.enemy.conditions.isChasing)
            {
                return(stateMachine.pursuitState);
            }
            else if (stateMachine.enemy.conditions.isAttackRange)
            {
                return(stateMachine.attackState);
            }
            else
            {
                return(this);
            }
        }
コード例 #2
0
 private void DoPursuit(BatStateMachine stateMachine)
 {
     stateMachine.navAgent.isStopped = false;
     if (stateMachine.navAgent.destination != GameManager.Instance.player.transform.position)
     {
         stateMachine.navAgent.SetDestination(GameManager.Instance.player.transform.position);
         stateMachine.SetPursuitAnim(true);
     }
     if (Vector3.Distance(stateMachine.navAgent.transform.position, stateMachine.navAgent.destination) <= stateMachine.navAgent.stoppingDistance)
     {
         stateMachine.enemy.conditions.isShootingRange = false;
         stateMachine.enemy.conditions.canShoot        = false;
         stateMachine.StopCoroutine("CounterToIsShootOn");
         stateMachine.enemy.conditions.isAttackRange = true;
         stateMachine.enemy.conditions.isChasing     = false;
     }
     else if (Vector3.Distance(stateMachine.navAgent.transform.position, stateMachine.navAgent.destination) <= stateMachine.enemy.stats.ShootingRange)
     {
         stateMachine.enemy.conditions.isShootingRange = true;
         stateMachine.enemy.conditions.isChasing       = false;
         stateMachine.enemy.conditions.isAttackRange   = false;
         stateMachine.ShootingMonobehaviour();
     }
     else if (Vector3.Distance(stateMachine.navAgent.transform.position, stateMachine.navAgent.destination) > stateMachine.enemy.stats.ShootingRange)
     {
         stateMachine.enemy.conditions.isShootingRange = false;
         stateMachine.enemy.conditions.canShoot        = false;
         stateMachine.StopCoroutine("CounterToIsShootOn");
         stateMachine.enemy.conditions.isWait = false;
     }
 }
コード例 #3
0
 public IState DoState(BatStateMachine stateMachine)
 {
     if (!stateMachine.GetIsDieAnim())
     {
         DoDeathState(stateMachine);
     }
     return(this);
 }
コード例 #4
0
        private void DoAttack(BatStateMachine stateMachine)
        {
            stateMachine.SetPursuitAnim(false);

            if (!stateMachine.enemy.conditions.isAttacking)// && stateMachine.enemy.conditions.isChasing)
            {
                stateMachine.transform.LookAt(GameManager.Instance.player.transform.position);

                stateMachine.SetAttackAnim(true);

                stateMachine.enemy.conditions.isAttacking = true;
            }
            if (Vector3.Distance(stateMachine.transform.position, GameManager.Instance.player.transform.position) > stateMachine.navAgent.stoppingDistance)
            {
                stateMachine.enemy.conditions.isAttackRange = false;
                stateMachine.enemy.conditions.isChasing     = true;
                stateMachine.enemy.conditions.isAttacking   = false;
                stateMachine.SetAttackAnim(false);
            }
        }
コード例 #5
0
 public IState DoState(BatStateMachine stateMachine)
 {
     DoGetHit(stateMachine);
     if (stateMachine.enemy.conditions.isWait)
     {
         return(stateMachine.waitState);
     }
     else if (stateMachine.enemy.conditions.isAttackRange)
     {
         return(stateMachine.attackState);
     }
     else if (stateMachine.enemy.conditions.isDead)
     {
         return(stateMachine.deathState);
     }
     else
     {
         return(stateMachine.pursuitState);
     }
 }
コード例 #6
0
        private void DoShooting(BatStateMachine stateMachine)
        {
            stateMachine.SetShootAnim(true);

            if (Vector3.Distance(stateMachine.navAgent.transform.position, stateMachine.navAgent.destination) <= stateMachine.navAgent.stoppingDistance)
            {
                stateMachine.enemy.conditions.isShootingRange = false;
                stateMachine.enemy.conditions.isAttackRange   = true;
                stateMachine.enemy.conditions.isChasing       = false;
                stateMachine.SetShootAnim(false);
            }
            else if (Vector3.Distance(stateMachine.navAgent.transform.position, stateMachine.navAgent.destination) > stateMachine.enemy.stats.ShootingRange)
            {
                stateMachine.enemy.conditions.isShootingRange = false;
                stateMachine.enemy.conditions.canShoot        = false;
                stateMachine.StopCoroutine("CounterToIsShootOn");
                stateMachine.enemy.conditions.isWait = false;
                stateMachine.SetShootAnim(false);
            }
        }
コード例 #7
0
        public IState DoState(BatStateMachine stateMachine)
        {
            DoWait(stateMachine);

            if (stateMachine.enemy.conditions.isWait)
            {
                return(this);
            }
            else if (stateMachine.enemy.conditions.isAttacking)
            {
                return(stateMachine.attackState);
            }
            else if (stateMachine.enemy.conditions.isHitten)
            {
                return(stateMachine.getHitState);
            }
            else
            {
                return(stateMachine.pursuitState);
            }
        }