public void FireTurretsGuns(BasePlayer player, AutoTurret turret) { if (turret.IsOnline() == true) { if (turret.GetAttachedWeapon().AmmoFraction() <= 0) { //nextShootTime = Time.time + turret.GetAttachedWeapon().GetReloadDuration(); turret.GetAttachedWeapon().TopUpAmmo(); //canGunShoot = false; } turret.FireAttachedGun(Vector3.zero, ConVar.PatrolHelicopter.bulletAccuracy); } }
private void MaybeUpdateAim() { _pluginInstance.TrackStart(); if (Turret == null || Turret.GetAttachedWeapon() == null || !Turret.HasTarget() || Turret.aimDir == Vector3.zero) { _pluginInstance.TrackEnd(); return; } var lookRotation = Quaternion.LookRotation(Turret.aimDir); var targetYaw = Quaternion.Euler(0, lookRotation.eulerAngles.y, 0); var targetPitch = Quaternion.Euler(lookRotation.eulerAngles.x, 0, 0); var gunYaw = Turret.gun_yaw.transform.rotation; var gunPitch = Turret.gun_pitch.transform.localRotation; var interpolation = _pluginInstance._pluginConfig.Interpolation; if (gunYaw != targetYaw) { Turret.gun_yaw.transform.rotation = Quaternion.Lerp(gunYaw, targetYaw, interpolation); } if (gunPitch != targetPitch) { Turret.gun_pitch.transform.localRotation = Quaternion.Lerp(gunPitch, targetPitch, interpolation); } _pluginInstance.TrackEnd(); }