Exemple #1
0
    /// <summary>
    /// Función para detectar cuanto se movió horizontalmente
    /// </summary>
    /// <returns>Cuanto se movió horizontalmente</returns>
    public float GetHorizontal()
    {
        float horizontal = 0;

        if (Application.isMobilePlatform)
        {
            horizontal = PhoneInput.GetHorizontal();
        }
        else
        {
            horizontal = PcInput.GetHorizontal();
        }

        return(horizontal);
    }
Exemple #2
0
    /// <summary>
    /// Función para detectar cuanto se movió verticalmente
    /// </summary>
    /// <returns>Cuanto se movió verticalmente</returns>
    public float GetVertical()
    {
        float vertical = 0;

        if (Application.isMobilePlatform)
        {
            vertical = PhoneInput.GetVertical();
        }
        else
        {
            vertical = PcInput.GetVertical();
        }

        return(vertical);
    }
    private void SetInputBasedOnPlatform()
    {
        IGameInput gameInput;

#if UNITY_ANDROID
        gameInput = new AndroidInput(this.acceleratorPedal, this.leftButton, this.rightButton, this.brakeButton);
#endif

#if UNITY_STANDALONE
        gameInput = new PcInput();
#endif

#if UNITY_EDITOR
        gameInput = new PcInput();
#endif
        foreach (var system in this.entityManager.World.Systems)
        {
            if (system is InputSystem inputSystem)
            {
                inputSystem.GameInput      = gameInput;
                inputSystem.InputSnapshots = this.InputSnapshots = new InputSnapshots();
            }
        }
    }