//!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); }
public MobileInputListener(bool setEnable) { m_currentAction = EInputAction.Idle; if (setEnable) { RegisterListeners(); } }
private static void AddActionButton(EInputAction action, string actionName, Dictionary <int, string> actions) { if (string.IsNullOrEmpty(actionName)) { return; } actions.Add((int)action, actionName); }
public EInputAction UpdateListener() { if (m_currentAction == EInputAction.JumpPressed) { m_currentAction = EInputAction.Idle; return(EInputAction.JumpPressed); } return(m_currentAction); }
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; } }
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; } }
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) { } }
public abstract bool GetKeyUp(string playerId, EInputAction action);
public bool IsUp(int playerId, EInputAction buttonName) { return(input.GetButtonUp(playerId, buttonName)); }
public abstract bool GetButtonUp(int playerId, EInputAction action);
public abstract float GetAxisRaw(int playerId, EInputAction action);
private void OnTap(Vector3 position) { m_currentAction = EInputAction.JumpPressed; }
public override bool GetButtonUp(int playerId, EInputAction action) { bool value = Input.GetButtonUp(_actions[playerId][(int)action]); //calling the action Unity Input System return(value); }
//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); }
public override bool GetKeyUp(string playerId, EInputAction action) { return(Input.GetKeyUp(_actionsKeys[playerId][(int)action])); }
public void ChangeActionsStatus(int playerId, EInputAction action, bool isEnabled) { buttonsEnabledStatus[playerId][action] = isEnabled; }
public void HandleButtonInput(string sButtonName, EInputAction eInputAction) { throw new System.NotImplementedException(); }
public bool IsActionEnabled(int playerId, EInputAction action) { return(buttonsEnabledStatus[playerId][action]); }