void Awake() { engageState = new EngageState(this); alertState = new AlertState(this); patrolState = new PatrolState(this); navMeshAgent = GetComponent <UnityEngine.AI.NavMeshAgent> (); currentState = patrolState; }
/// смена состояний public void ChangeState(IEnemyStates newState) { if (currentState != null) { currentState.Exit(); } currentState = newState; currentState.Enter(this); }
public override void Enter(IEnemyStates previousState) { Enemy.IsVisible = true; Enemy.LeftFacing = false; Enemy.IsAnimated = true; CurrentState = this; PreviousState = previousState; Enemy.Color = Color.White; //Injured variable is 1 for standardstate Enemy.InjuredVariable = 1; Enemy.TotalFrames = 2; Enemy.InjuredHeightFactor = 1; Enemy.InjuredPositionFactor = 0; }
public override void Enter(IEnemyStates previousState) { Enemy.IsAnimated = false; CurrentState = this; PreviousState = previousState; //Injured variable is 1 for standardstate Enemy.InjuredVariable = 0; Enemy.TotalFrames = 3; Enemy.CurrentFrame = 2; Enemy.InjuredHeightFactor = 0.6f; //Send the collision box position so far off the screen that it is like turning of collision. Enemy.InjuredPositionFactor = 10; ExitState(); }
// Use this for initialization void Start() { currentState = patrolState; }
public virtual void Enter(IEnemyStates previousState) { CurrentState = this; PreviousState = previousState; }