Beispiel #1
0
        public override Type StateUpdate()
        {
            _enemyController.Agent.speed            = _statBehaviour.GetStatValue(StatType.Speed);
            _enemyController.Agent.stoppingDistance = _statBehaviour.GetStatValue(StatType.AttackRange);
            _enemyController.Animator.SetFloat("Speed", 1.0f);
            _enemyController.Animator.SetBool("isAttacking", false);

            if (!_enemyController.CheckDistance(_statBehaviour.GetStatValue(StatType.Awareness)))
            {
                return(typeof(WanderState));
            }

            if (_enemyController.CheckDistance(_statBehaviour.GetStatValue(StatType.AttackRange)))
            {
                _enemyController.Animator.SetFloat("Speed", 0.0f);
                return(typeof(CombatState));
            }

            FallowPlayer();
            return(null);
        }
Beispiel #2
0
        public override Type StateUpdate()
        {
            _enemyController.Agent.speed = _statsBehaviour.GetStatValue(StatType.Speed) / 2.0f;
            _enemyController.Animator.SetFloat("Speed", 0.5f);

            if (_transform.position == _nextPosition || _nextPosition == Vector3.zero)
            {
                _nextPosition = RandomNavmeshLocation(10.0f);
            }

            _enemyController.Agent.SetDestination(_nextPosition);

            if (_enemyController.CheckDistance(_statsBehaviour.GetStatValue(StatType.Awareness)))
            {
                return(typeof(ChaseState));
            }

            return(null);
        }