protected override State CreateStatesAndReturnInitial() { IdleState initialState = new IdleState(stateMachine); TurretAttackState attackState = new TurretAttackState(stateMachine, CreateStats()); TurretLocateState locatingState = new TurretLocateState(stateMachine); stateMachine.AddStates((typeof(IdleState), initialState), (typeof(LocatorState), locatingState) , (typeof(AIAttackState), attackState)); return(initialState); }
protected virtual void EnterTurretAttackState() { switch (attackState) { case TurretAttackState.Anticipation: ChangeAimingRedDotState(AimingRedDotState.Following); animator.SetTrigger("AnticipationTrigger"); currentAnticipationTime = attackValues.maxAnticipationTime; restTime = maxRestTime + UnityEngine.Random.Range(-randomRangeRestTime, randomRangeRestTime); break; case TurretAttackState.Attack: attackState = TurretAttackState.Attack; ChangeAimingRedDotState(AimingRedDotState.NotVisible); animator.SetTrigger("AttackTrigger"); break; case TurretAttackState.Rest: break; case TurretAttackState.NotAttacking: break; } }
protected void ChangingTurretAttackState(TurretAttackState _newState) { ExitTurretAttackState(); attackState = _newState; EnterTurretAttackState(); }