예제 #1
0
    void HandleInput()
    {
        //Keyboard input
        if (Application.platform == RuntimePlatform.WindowsEditor)
        {
            float horizontal = CrossPlatformInputManager.GetAxis("Horizontal");
            missile.SetTargetAngle(missile.DegreeHeading() - horizontal * 90);
        }
        //Screen touch input
        else
        {
            byte horizontal = 0;

            if (CrossPlatformInputManager.GetButtonDown("Left"))
            {
                horizontal += 1;
            }

            if (CrossPlatformInputManager.GetButtonDown("Right"))
            {
                horizontal += 2;
            }

            switch (horizontal)
            {
            case 1:     //left
                missile.SetTargetAngle(missile.DegreeHeading() + 90);
                break;

            case 2:     //right
                missile.SetTargetAngle(missile.DegreeHeading() - 90);
                break;

            case 3:     //both
                //TODO: Implement some fancy spectial funcs here
                break;
            }
        }
    }