Пример #1
0
        /// <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);
        }
Пример #2
0
        /// <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");
                }
            }
        }
Пример #5
0
 /// <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");
 }
Пример #6
0
        /*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();
        }
Пример #10
0
 /// <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();
 }
Пример #11
0
 /// <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();
 }
Пример #12
0
 public abstract void Exit(PlayerBaseState nextState);
Пример #13
0
 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");
 }