Exemplo n.º 1
0
    private void Update()
    {
        if (Input.GetAxis("Horizontal") > 0)
        {
            m_ship.TurnClockwise();
            horizontal = true;
        }
        else if (Input.GetAxis("Horizontal") < 0)
        {
            m_ship.TurnCounterClockWise();
            horizontal = true;
        }
        else if (horizontal)
        {
            horizontal = false;
            m_ship.StopTurn();
        }

        if (Input.GetAxis("Vertical") > 0)
        {
            m_ship.Thrust(1);
            vertical = true;
        }
        else if (vertical)
        {
            vertical = false;
            m_ship.StopThrust();
        }

        if (Input.GetButtonDown("Fire"))
        {
            m_ship.GetComponentInChildren <ABR_Turret>().FireBullet();
        }
    }
Exemplo n.º 2
0
    private void Update()
    {
        float thrust = m_thrustInput.value / m_thrustInput.maxValue;

        if (thrust > 0)
        {
            if (!started)
            {
                StartTouch();
            }
            m_ship.Thrust(thrust);
        }
        else
        {
            if (started)
            {
                EndTouch();
            }
        }
    }
Exemplo n.º 3
0
    private void Update()
    {
        if (m_touchArea.PointerDown)
        {
            if (!started)
            {
                StartTouch();
            }

            Vector2 touchPosition = m_viewport.ScreenToWorldPoint(m_touchArea.TouchPosition);

            float distanceFromCenter = (touchPosition - (Vector2)transform.position).magnitude;

            m_ship.Thrust(Mathf.Clamp01((distanceFromCenter - m_turnOnlyRadius) / (m_thrustRadius - m_turnOnlyRadius)));
        }
        else
        {
            if (started)
            {
                EndTouch();
            }
        }
    }
Exemplo n.º 4
0
    private void Update()
    {
        if (m_input.PointerDown)
        {
            if (!started)
            {
                StartTouch();
            }

            Vector2 input = m_input.Axes;

            float distanceFromCenter = input.magnitude;

            m_ship.Thrust(Mathf.Clamp01((distanceFromCenter - m_turnOnlyRadius) / (m_thrustRadius - m_turnOnlyRadius)));
        }
        else
        {
            if (started)
            {
                EndTouch();
            }
        }
    }