/// <summary> /// Create a vortex at the given position. /// </summary> /// <param name="position"></param> /// <returns></returns> public TornadoVortex CreateVortex(Vector3 position) { if (spawnInProgress) // tornado already spawning in { return(null); } for (var i = _activeVortexList.Length - 1; i > 0; i--) { _activeVortexList[i] = _activeVortexList[i - 1]; } position.Z = World.GetGroundHeight(position) - 10.0f; var tVortex = new TornadoVortex(position, false); tVortex.Build(); _activeVortexList[0] = tVortex; ActiveVortexCount = Math.Min(ActiveVortexCount + 1, _activeVortexList.Length); if (soundEnabled) { if (_tornadoLowRumble != null) { _tornadoLowRumble.SetVolume(0.0f); var volumeLevel = 1.0f - (1.0f / 300.0f * Vector3.Distance2D(position, GameplayCamera.Position)); volumeLevel = volumeLevel <0.0f ? 0.0f : volumeLevel> 1.0f ? 1.0f : volumeLevel; _tornadoLowRumble.DoFadeIn(5000, volumeLevel); } } if (ScriptThread.GetVar <bool>("notifications")) { UI.Notify("Tornado spawned nearby."); } spawnInProgress = true; return(null); }
/// <summary> /// Create a vortex at the given position. /// </summary> /// <param name="position"></param> /// <returns></returns> public TornadoVortex CreateVortex(Vector3 position) { for (int i = _activeVortexList.Length - 1; i > 0; i--) { _activeVortexList[i] = _activeVortexList[i - 1]; } position.Z = World.GetGroundHeight(position) - 10.0f; var tVortex = new TornadoVortex(position); tVortex.Build(); _activeVortexList[0] = tVortex; ActiveVortexCount = Math.Min(ActiveVortexCount + 1, _activeVortexList.Length); if (ScriptThread.GetVar <bool>("notifications")) { UI.Notify("Tornado spawned nearby."); } return(tVortex); }