Exemplo n.º 1
0
    void DesktopController()
    {
        // Desktop controller
        flight.SimpleControl = SimpleControl;

        // lock mouse position to the center.
        if (this.gameObject.GetComponent <FlightOnWin>().isWin == false)
        {
            Screen.lockCursor = true;

            flight.AxisControl(new Vector2(Input.GetAxis("Mouse X"), Input.GetAxis("Mouse Y")));
            if (SimpleControl)
            {
                flight.DirectVelocity = false;
                flight.TurnControl(Input.GetAxis("Mouse X"));
            }
            else
            {
                flight.DirectVelocity = directVelBack;
            }

            flight.TurnControl(Input.GetAxis("Horizontal"));
            flight.SpeedUp(Input.GetAxis("Vertical"));


            if (Input.GetButton("Fire1"))
            {
                flight.WeaponControl.LaunchWeapon();
            }

            if (Input.GetButtonDown("Fire2"))
            {
                flight.WeaponControl.SwitchWeapon();
            }

            if (Input.GetKeyDown(KeyCode.C))
            {
                if (View)
                {
                    View.SwitchCameras();
                }
            }

            if (Input.GetKeyDown(KeyCode.N))
            {
                //Test Win...
                this.gameObject.GetComponent <FlightOnWin>().OnWin();
            }
        }
        else
        {
            Screen.lockCursor = false;
        }
    }
Exemplo n.º 2
0
    void Update()
    {
        if (!flight || !Active)
        {
            return;
        }


        Screen.lockCursor = true;

        flight.AxisControl(new Vector2(Input.GetAxis("Mouse X"), Input.GetAxis("Mouse Y")));

        if (Input.GetKey(KeyCode.A))
        {
            flight.TurnControl(-1);
        }
        if (Input.GetKey(KeyCode.D))
        {
            flight.TurnControl(1);
        }
        if (Input.GetKey(KeyCode.W))
        {
            flight.SpeedUp();
        }

        if (Input.GetButton("Fire1"))
        {
            flight.WeaponControl.LaunchWeapon();
        }

        if (Input.GetKeyDown(KeyCode.R))
        {
            flight.WeaponControl.SwitchWeapon();
        }
    }
Exemplo n.º 3
0
    void DesktopController()
    {
        // Desktop controller
        flight.SimpleControl = SimpleControl;

        // lock mouse position to the center.
        MouseLock.MouseLocked = true;

        flight.AxisControl(new Vector2(Input.GetAxis("Mouse X"), Input.GetAxis("Mouse Y")));
        if (SimpleControl)
        {
            flight.DirectVelocity = false;
            flight.TurnControl(Input.GetAxis("Mouse X"));
        }
        else
        {
            flight.DirectVelocity = directVelBack;
        }

        flight.TurnControl(Input.GetAxis("Horizontal"));
        flight.SpeedUp(Input.GetAxis("Vertical"));


        if (Input.GetButton("Fire1"))
        {
            flight.WeaponControl.LaunchWeapon();
        }

        if (Input.GetButtonDown("Fire2"))
        {
            flight.WeaponControl.SwitchWeapon();
        }

        if (Input.GetKeyDown(KeyCode.C))
        {
            if (View)
            {
                View.SwitchCameras();
            }
        }
    }