Ejemplo n.º 1
0
    private void InputDetection()
    {
        var horizontal = SimpleInput.GetAxis("Horizontal");

        if (horizontal < 0f)
        {
            state.HideShield();
            state.MoveLeft();
        }
        else if (horizontal > 0f)
        {
            state.HideShield();
            state.MoveRight();
        }
        else if (horizontal == 0f)
        {
            state.GetIdle();
        }

        var vertical = SimpleInput.GetAxis("Vertical");

        if (SimpleInput.GetButton("Jump") || vertical > 0f)
        {
            state.MoveUp();
        }
        else if (vertical < 0f)
        {
            state.MoveDown();
        }

        if (SimpleInput.GetButton("Fire1"))
        {
            state.HideShield();
            state.UseWeapon();
        }
        else
        {
            if (SimpleInput.GetButtonDown("Fire2"))
            {
                state.UseShield();
            }
            else if (SimpleInput.GetButtonUp("Fire2"))
            {
                state.HideShield();
            }
        }

        if (SimpleInput.GetButton("Jump"))
        {
            GameManager.S.PauseUnpause();
        }

        if (Application.platform == RuntimePlatform.Android)
        {
            if (Input.GetKeyDown(KeyCode.Escape))
            {
                GameManager.S.PauseUnpause();
            }
        }
    }
Ejemplo n.º 2
0
    private void InputDetection()
    {
        if (horizontal < 0f)
        {
            state.HideShield();
            state.MoveLeft();
        }
        else if (horizontal > 0f)
        {
            state.HideShield();
            state.MoveRight();
        }
        else if (horizontal == 0f)
        {
            state.GetIdle();
        }

        if (jump || vertical > 0f)
        {
            state.MoveUp();
            jump = false;
        }
        else if (vertical < 0f)
        {
            state.MoveDown();
        }

        if (fire1)
        {
            state.HideShield();
            state.UseWeapon();
            fire1 = false;
        }
        else
        {
            if (fire2)
            {
                state.UseShield();
            }
            else if (!fire2)
            {
                state.HideShield();
            }
        }
    }