void Attack(int weaponselected) { if (Target) { if (weaponselected == 2) { if (targetState == TargetState.IsLocked) { flight.LaunchMissile(); } } else { flight.ShootMiniGun(); } } }
// Update is called once per frame void Update() { if (!Target) { FindTarget(); } Pitch = Input.GetAxis("Pitch"); Roll = Input.GetAxis("Roll"); Throttle = Input.GetAxis("Throttle"); Yaw = Input.GetAxis("Yaw"); plane.Move(Pitch: Pitch, Roll: Roll, Yaw: Yaw, Throttle: Throttle); if (Input.GetKey(KeyCode.LeftControl)) { plane.ShootMiniGun(); } if (Input.GetKeyDown(KeyCode.Space)) { plane.LaunchMissile(); } }