Exemplo n.º 1
0
        private void InitMeleeStateMachine()
        {
            _meleeStateMachine = new FinitStateMachine();

            MeleeIdleDetectionState idleState = new MeleeIdleDetectionState
                                                    (_meleeStateMachine, transform, player.transform, GameSettings.Instance.MeleeDetectionRadius);

            MeleeAttackState attackState
                = new MeleeAttackState(_meleeStateMachine, player.transform, _meleeCastPoint, _meleeSpawnPoint);

            CooldownState cooldownState = new CooldownState
                                              (_meleeStateMachine, idleState, GameSettings.Instance.MeleeCooldownBase,
                                              GameSettings.Instance.MeleeCooldownShift);

            _meleeStateMachine.AddStates(idleState, attackState, cooldownState);
        }
Exemplo n.º 2
0
        private void InitRangeStateMachine()
        {
            _rangeStateMachine = new FinitStateMachine();

            RangeIdleDetectionState idleState = new RangeIdleDetectionState
                                                    (_rangeStateMachine, transform, player.transform, GameSettings.Instance.RangeDetectionRadius);

            SingleProjectileCaseState singleCastState
                = new SingleProjectileCaseState(_rangeStateMachine, player.transform, _singleProjectileSpawnPoint);

            SeveralProjectilesCastState severalCastState
                = new SeveralProjectilesCastState(_rangeStateMachine, player.transform, _severalProjectileSpawnPoints);

            AttackState attackState = new AttackState(_rangeStateMachine, singleCastState, severalCastState);

            CooldownState cooldownState = new CooldownState(
                _rangeStateMachine, idleState, GameSettings.Instance.RangeCooldownBase,
                GameSettings.Instance.RangeCooldownShift);

            _rangeStateMachine.AddStates(idleState, singleCastState, severalCastState, attackState, cooldownState);
        }