/// <summary> /// Enter the state /// </summary> /// <param name="prevState">Previous state</param> public override void Enter(PlayerBaseState prevState) { Debug.Log("Enter Player Moving State"); target = PlayerController.Instance.RouteBuilder.GetCoordinateTarget(prevState.InputPosition); hasTarget = true; PlayerController.Instance.SetMovingAnimation(true); PlayerController.Instance.PlaySound(PlayerController.PlayerSound.Run); }
/// <summary> /// Exit from the state /// </summary> /// <param name="nextState">Next state</param> public override void Exit(PlayerBaseState nextState) { hasTarget = false; PlayerController.Instance.ChangeSteps(1); PlayerController.Instance.RouteBuilder.ClearBuiltPaths(); PlayerController.Instance.SetMovingAnimation(false); PlayerController.Instance.StopSound(); Debug.Log("Exit Player Moving State"); }
/// <summary> /// Switch state on the state with name: newState /// </summary> /// <param name="newState">Name of the state</param> public void SwitchState(string newState) { PlayerBaseState state = FindState(newState); if (state == null) { Debug.LogError("Can't find the state named " + newState); return; } PlayerBaseState oldState = stateStack[stateStack.Count - 1]; stateStack[stateStack.Count - 1].Exit(state); stateStack.RemoveAt(stateStack.Count - 1); stateStack.Add(state); state.Enter(oldState); }
/// <summary> /// Enter the state /// </summary> /// <param name="prevState">Previous state</param> public override void Enter(PlayerBaseState prevState) { Debug.Log("Enter Player Finishing State"); if (PlayerController.Instance.OnFinish && IsGoalReached()) { PlayerController.Instance.SwitchState("Finished"); } else { if (PlayerController.Instance.Steps == 0) { GameManager.Instance.SwitchState("GameOver"); } else { PlayerController.Instance.SwitchState("Idle"); } } }
/// <summary> /// Exit from the state /// </summary> /// <param name="nextState">Next state</param> public override void Exit(PlayerBaseState nextState) { hasInput = false; inputPosition = Vector3.zero; Debug.Log("Exit Player Idle State"); }
/*public override Vector3 InputPosition * { * get { return Camera.main.ScreenToWorldPoint(inputPosition); } * }*/ /// <summary> /// Enter the state /// </summary> /// <param name="prevState">Previous state</param> public override void Enter(PlayerBaseState prevState) { Debug.Log("Enter Player Idle State"); }
/// <summary> /// Exit from the state /// </summary> /// <param name="nextState">Next state</param> public override void Exit(PlayerBaseState nextState) { Debug.Log("Exit Player Attacked State"); }
/// <summary> /// Enter the state /// </summary> /// <param name="prevState">Previous state</param> public override void Enter(PlayerBaseState prevState) { Debug.Log("Enter Player Attacked State"); // attacked animation PlayerController.Instance.TriggerAttacked(); }
/// <summary> /// Enter the state /// </summary> /// <param name="prevState">Previous state</param> public override void Enter(PlayerBaseState prevState) { Debug.Log("Enter Player Finished State"); PlayerController.Instance.CallOnFinished(); }
/// <summary> /// Exit from the state /// </summary> /// <param name="nextState">Next state</param> public override void Exit(PlayerBaseState nextState) { Debug.Log("Exit Player Empty State"); PlayerController.Instance.SetPlayerData(); }
/// <summary> /// Enter the state /// </summary> /// <param name="prevState">Previous state</param> public override void Enter(PlayerBaseState prevState) { Debug.Log("Enter Player Empty State"); PlayerController.Instance.RemoveShield(); PlayerController.Instance.ResetPlayerData(); }
public abstract void Exit(PlayerBaseState nextState);
public abstract void Enter(PlayerBaseState prevState);
/// <summary> /// Exit from the state /// </summary> /// <param name="nextState">Next state</param> public override void Exit(PlayerBaseState nextState) { hasInput = false; Debug.Log("Exit Player Waiting State"); }
/// <summary> /// Enter the state /// </summary> /// <param name="prevState">Previous state</param> public override void Enter(PlayerBaseState prevState) { Debug.Log("Enter Player Waiting State"); PlayerController.Instance.RouteBuilder.DrawPossiblePaths(); inputPosition = Vector3.zero; }
/// <summary> /// Exit from the state /// </summary> /// <param name="nextState">Next state</param> public override void Exit(PlayerBaseState nextState) { Debug.Log("Exit Player Finishing State"); }