Пример #1
0
    //!calling the action Unity Input System

    public override bool GetButton(int playerId, EInputAction action)
    {
        //playerId - number of dictionary in array. Action - number of string in dictionary. 1) Prefix null. 2) Prefix != null
        bool value = Input.GetButton(_actions[playerId][(int)action]); //example of return:  1) Jump         2) hellPlayer1Jump

        return(value);
    }
Пример #2
0
 public MobileInputListener(bool setEnable)
 {
     m_currentAction = EInputAction.Idle;
     if (setEnable)
     {
         RegisterListeners();
     }
 }
Пример #3
0
 private static void AddActionButton(EInputAction action, string actionName, Dictionary <int, string> actions)
 {
     if (string.IsNullOrEmpty(actionName))
     {
         return;
     }
     actions.Add((int)action, actionName);
 }
Пример #4
0
 public EInputAction UpdateListener()
 {
     if (m_currentAction == EInputAction.JumpPressed)
     {
         m_currentAction = EInputAction.Idle;
         return(EInputAction.JumpPressed);
     }
     return(m_currentAction);
 }
Пример #5
0
 private void OnHold(HoldStatus status, Vector3 position)
 {
     if (status == HoldStatus.Begin)
     {
         Vector3 viewportPosition = CameraManager.Instance.Main.ScreenToViewportPoint(position);
         if (viewportPosition.x >= 0.5)
         {
             m_currentAction = EInputAction.RightPressed;
         }
         else
         {
             m_currentAction = EInputAction.LeftPressed;
         }
     }
     else
     {
         m_currentAction = EInputAction.Idle;
     }
 }
Пример #6
0
    public void UpdateAction(EInputAction action)
    {
        switch (action)
        {
        case EInputAction.LeftPressed:
            m_entity.MoveLeft(m_data.MovementSpeed);
            break;

        case EInputAction.RightPressed:
            m_entity.MoveRight(m_data.MovementSpeed);
            break;

        case EInputAction.JumpPressed:
            m_entity.Jump(m_data.JumpForce);
            break;

        case EInputAction.Idle:
            m_entity.Stop();
            break;
        }
    }
Пример #7
0
    public void UpdateSession()
    {
        if (m_state == EGameSessionSate.PreGame)
        {
        }
        else if (m_state == EGameSessionSate.Running)
        {
            EInputAction action = m_inputListener.UpdateListener();
            m_mainCharacter.Update();
            m_mainCharacter.UpdateAction(action);
            for (int i = 0, count = m_enemies.Count; i < count; i++)
            {
                m_enemies[i].Update();
            }

            CheckCollectables();

            if (CheckWinConditions())
            {
                m_result.SessionWon = true;
                m_state             = EGameSessionSate.PostGame;
                m_sessionFinished   = true;
                m_mainCharacter.Entity.StopAll();
            }

            if (CheckFailCondition())
            {
                m_result.SessionWon = false;
                m_state             = EGameSessionSate.PostGame;
                m_sessionFinished   = true;
                m_mainCharacter.Entity.StopAll();
            }
        }
        else if (m_state == EGameSessionSate.PostGame)
        {
        }
    }
Пример #8
0
 public abstract bool GetKeyUp(string playerId, EInputAction action);
Пример #9
0
 public bool IsUp(int playerId, EInputAction buttonName)
 {
     return(input.GetButtonUp(playerId, buttonName));
 }
Пример #10
0
 public abstract bool GetButtonUp(int playerId, EInputAction action);
Пример #11
0
 public abstract float GetAxisRaw(int playerId, EInputAction action);
Пример #12
0
 private void OnTap(Vector3 position)
 {
     m_currentAction = EInputAction.JumpPressed;
 }
Пример #13
0
    public override bool GetButtonUp(int playerId, EInputAction action)
    {
        bool value = Input.GetButtonUp(_actions[playerId][(int)action]); //calling the action Unity Input System

        return(value);
    }
Пример #14
0
    //input is not smoothed, keyboard input will always be either -1, 0 or 1.
    public override float GetAxisRaw(int playerId, EInputAction action)
    {
        float value = Input.GetAxisRaw(_actions[playerId][(int)action]); //calling the action Unity Input System

        return(value);
    }
Пример #15
0
 public override bool GetKeyUp(string playerId, EInputAction action)
 {
     return(Input.GetKeyUp(_actionsKeys[playerId][(int)action]));
 }
Пример #16
0
 public void ChangeActionsStatus(int playerId, EInputAction action, bool isEnabled)
 {
     buttonsEnabledStatus[playerId][action] = isEnabled;
 }
Пример #17
0
 public void HandleButtonInput(string sButtonName, EInputAction eInputAction)
 {
     throw new System.NotImplementedException();
 }
Пример #18
0
 public bool IsActionEnabled(int playerId, EInputAction action)
 {
     return(buttonsEnabledStatus[playerId][action]);
 }