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; } }
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(); } }
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(); } } }