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); }
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); }
protected override void InitStateMachine() { _stateMachine = new FinitStateMachine(); BaseState idleState = null; if (data.WayPoints != null && data.WayPoints.Length > 1) { idleState = new PatrolState(_stateMachine, data); } else { idleState = new IdleDetectionState(_stateMachine, data); } var attackState = new RangeAttackState(_stateMachine, data); var chasingState = new ChasingState(_stateMachine, data, attackState); var cooldownState = new ChasingCooldownState(_stateMachine, data, attackState); var takeDamageState = new TakeDamageState(_stateMachine, data, chasingState); _stateMachine.AddStates(idleState, chasingState, attackState, cooldownState, takeDamageState); }