Example #1
0
    public void ExecuteAction(InputState inputState)
    {
        if (m_ActiveViking == null)
        {
            Debug.LogWarning("NO active vikings");
            return;
        }

        if (inputState.CheckNoInput())
        {
            m_ActiveViking.NoInput();
            return;
        }

        if (inputState.CheckTriggered(InputAction.SELECT_BAELOG))
        {
            ChangeCameraFollowViking(m_Baelog);
            m_ActiveViking = m_Baelog.GetComponent <BaseViking>();
        }
        else if (inputState.CheckTriggered(InputAction.SELECT_ERIC))
        {
            ChangeCameraFollowViking(m_Eric);
            m_ActiveViking = m_Eric.GetComponent <BaseViking>();
        }
        else if (inputState.CheckTriggered(InputAction.SELECT_OLAF))
        {
            ChangeCameraFollowViking(m_Olaf);
            m_ActiveViking = m_Olaf.GetComponent <BaseViking>();
        }

        //if (inputState.CheckPressed(InputAction.RIGHT) || inputState.CheckPressed(InputAction.LEFT))
        //{
        //    MoveHorizontaly(inputState.CheckPressed(InputAction.RIGHT) ? 1 : -1);
        //}
        //else if (inputState.CheckPressed(InputAction.DOWN) || inputState.CheckPressed(InputAction.UP))
        //{
        //    MoveVertically(inputState.CheckPressed(InputAction.UP) ? 1 : -1);
        //}
        //else
        //{
        //    m_ActiveViking.Action(inputState);
        //}
        m_ActiveViking.SetInputState(inputState);
    }