Beispiel #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);
    }
Beispiel #2
0
 public MobileInputListener(bool setEnable)
 {
     m_currentAction = EInputAction.Idle;
     if (setEnable)
     {
         RegisterListeners();
     }
 }
Beispiel #3
0
 private static void AddActionButton(EInputAction action, string actionName, Dictionary <int, string> actions)
 {
     if (string.IsNullOrEmpty(actionName))
     {
         return;
     }
     actions.Add((int)action, actionName);
 }
Beispiel #4
0
 public EInputAction UpdateListener()
 {
     if (m_currentAction == EInputAction.JumpPressed)
     {
         m_currentAction = EInputAction.Idle;
         return(EInputAction.JumpPressed);
     }
     return(m_currentAction);
 }
Beispiel #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;
     }
 }
Beispiel #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;
        }
    }
Beispiel #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)
        {
        }
    }
Beispiel #8
0
 public abstract bool GetKeyUp(string playerId, EInputAction action);
 public bool IsUp(int playerId, EInputAction buttonName)
 {
     return(input.GetButtonUp(playerId, buttonName));
 }
Beispiel #10
0
 public abstract bool GetButtonUp(int playerId, EInputAction action);
Beispiel #11
0
 public abstract float GetAxisRaw(int playerId, EInputAction action);
Beispiel #12
0
 private void OnTap(Vector3 position)
 {
     m_currentAction = EInputAction.JumpPressed;
 }
Beispiel #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);
    }
Beispiel #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);
    }
Beispiel #15
0
 public override bool GetKeyUp(string playerId, EInputAction action)
 {
     return(Input.GetKeyUp(_actionsKeys[playerId][(int)action]));
 }
Beispiel #16
0
 public void ChangeActionsStatus(int playerId, EInputAction action, bool isEnabled)
 {
     buttonsEnabledStatus[playerId][action] = isEnabled;
 }
Beispiel #17
0
 public void HandleButtonInput(string sButtonName, EInputAction eInputAction)
 {
     throw new System.NotImplementedException();
 }
Beispiel #18
0
 public bool IsActionEnabled(int playerId, EInputAction action)
 {
     return(buttonsEnabledStatus[playerId][action]);
 }