Exemplo n.º 1
0
 public void HandleInput(Inputs inputs)
 {
     if (!_wonCurrentLevel)
     {
         _currentState.HandleInput(inputs);
     }
 }
Exemplo n.º 2
0
 // Update is called once per frame
 private void FixedUpdate()
 {
     //The player's actions are controlled through two functions.
     //State update is what actually happens each frame during the state.
     currentState.StateUpdate();
     //
     currentState.HandleInput();
 }
Exemplo n.º 3
0
 private void Update()
 {
     state.HandleInput(this, input);
     if (attackState != null)
     {
         attackState.HandleInput(this, input);
     }
 }
    private void Update()
    {
        m_PlayerState.HandleBehaviour();
        m_PlayerState.HandleInput();
        m_PlayerState.HandlePhysics();

        if (m_Input.m_SwitchButtonDown && m_CanChangeCharacter)
        {
            if (m_PlayerData.m_ActiveCharacter.Equals(ActiveCharacter.cobalt))
            {
                m_PlayerData.m_ActiveCharacter = ActiveCharacter.crimson;
            }
            else
            {
                m_PlayerData.m_ActiveCharacter = ActiveCharacter.cobalt;
            }
        }

        switch (m_PlayerData.m_ActiveCharacter)
        {
        case ActiveCharacter.cobalt:
            m_Animator.SetLayerWeight(1, 0f);
            if (m_CobaltBehaviour.m_AllowShooting)
            {
                m_CobaltBehaviour.HandleShooting(m_PlayerPhysicsBehaviour.m_Rigidbody2D.transform, m_PlayerPhysicsBehaviour.m_Direction,
                                                 m_Input.m_RangedAttackButton, m_CobaltData.m_ShootSpeed, m_CobaltBulletController);
            }
            m_Animator.SetFloat("cobaltShootState", m_CobaltBehaviour.m_ShootState);
            if (m_Input.m_UtillityButtonDown)
            {
                m_CobaltBulletController.SwitchPolar();
            }
            break;

        case ActiveCharacter.crimson:
            m_Animator.SetLayerWeight(1, 1f);
            break;
        }
        if (m_Input.m_UtillityButtonDown && m_CanChangeColor)
        {
            if (m_PlayerData.m_ActiveColor.Equals(ActiveColor.normal))
            {
                m_PlayerData.m_ActiveColor = ActiveColor.alt;
            }
            else
            {
                m_PlayerData.m_ActiveColor = ActiveColor.normal;
            }
        }
        m_Animator.SetFloat("activeColor", (float)m_PlayerData.m_ActiveColor);
    }
Exemplo n.º 5
0
        public void HandleInput(KeyboardState input)
        {
            IPlayerState newState = _state.HandleInput(this, input);

            if (newState != null && _state != newState)
            {
                if (_state != null)
                {
                    _state.Exit(this);
                }

                _state = newState;
                _state.Enter(this);
            }
        }
Exemplo n.º 6
0
        public void HandleInput(Input input)
        {
            IPlayerState temp = _state.HandleInput(this, input);

            if (temp != _state)
            {
                _state.ExitState(this);
                _state = null; // delete old state (not sure if this works?)
                _state = temp;
                _state.EnterState(this);
            }

            if (input == Input.Idle)
            {
                _state.TimePass(1);
                Console.WriteLine("Time has passed by 1");
            }
            if (input == Input.TimeFastForward)
            {
                _state.TimePass(10);
                Console.WriteLine("Time has passed by 10");
            }
        }