private void FindWindZone() { if (!WindZone) { WindZone = (WindZone)FindObjectOfType(typeof(WindZone)); } }
private void ApplySettings() { var windSettings = VolumeManager.instance.stack.GetComponent <BasicWind>(); if (windSettings == null) { return; } if (windZone == null) { windZone = gameObject.GetComponent <WindZone>(); } if (windZone != null) { GetDirectionAndSpeed(); } Shader.SetGlobalTexture(BasicWindShaderIDs.TexNoise, windSettings.noiseTexture.value); Shader.SetGlobalTexture(BasicWindShaderIDs.TexGust, windSettings.gustMaskTexture.value); Shader.SetGlobalVector(BasicWindShaderIDs.WorldDirectionAndSpeed, new Vector4(windDirection.x, windDirection.y, windDirection.z, windSpeed * 0.2777f)); Shader.SetGlobalFloat(BasicWindShaderIDs.FlexNoiseScale, 1.0f / Mathf.Max(0.01f, windSettings.flexNoiseWorldSize.value)); Shader.SetGlobalFloat(BasicWindShaderIDs.ShiverNoiseScale, 1.0f / Mathf.Max(0.01f, windSettings.shiverNoiseWorldSize.value)); Shader.SetGlobalFloat(BasicWindShaderIDs.Turbulence, windSpeed * windTurbulence); Shader.SetGlobalFloat(BasicWindShaderIDs.GustSpeed, windSettings.gustSpeed.value); Shader.SetGlobalFloat(BasicWindShaderIDs.GustScale, windSettings.gustScale.value); Shader.SetGlobalFloat(BasicWindShaderIDs.GustWorldScale, 1.0f / Mathf.Max(0.01f, windSettings.gustWorldSize.value)); Shader.SetGlobalFloat(BasicWindShaderIDs.Attenuation, windSettings.attenuation.value); }
/// <summary> /// Sets up the wind manager /// </summary> private void Setup() { m_shaderPropertyIDWindGlobals = Shader.PropertyToID("_PW_WindGlobals"); m_shaderPropertyIDWindGlobalsB = Shader.PropertyToID("_PW_WindGlobalsB"); if (m_windZone == null) { m_windZone = GetWindZone(); } if (m_windZone == null) { m_windDirection = m_windZone.transform.forward; windGlobals.x = m_windDirection.x; windGlobals.y = m_windDirection.y; windGlobals.z = m_windDirection.z; windGlobals.w = m_windZone.windMain; m_currentWindSpeed = m_windZone.windMain; m_currentWindVolume = Mathf.Clamp01(m_windZone.windMain); } if (Application.isPlaying) { m_windAudioSource = GetWindAudioSource(); if (m_windAudioSource != null) { m_windAudioSource.clip = m_windAudioClip; m_windAudioSource.volume = m_currentWindVolume; if (!m_windAudioSource.isPlaying) { m_windAudioSource.Play(); } } } }
// Use this for initialization void Start() { wind = GetComponentInChildren <WindZone>(); if (wind != null) { startWindRadius = wind.radius; startWindStr = wind.windMain; } _light = GetComponentInChildren <Light>(); if (_light != null) { startLightRange = _light.range; } var particles = GetComponentsInChildren <ParticleSystem>(); foreach (var particle in particles) { #if UNITY_5_5_OR_NEWER var main = particle.main; main.scalingMode = ParticleSystemScalingMode.Hierarchy; #else particle.scalingMode = ParticleSystemScalingMode.Hierarchy; #endif } }
void Init() { m_WindZone = GetComponent <WindZone>(); CTIWindPID = Shader.PropertyToID("_CTI_SRP_Wind"); CTITurbulencedPID = Shader.PropertyToID("_CTI_SRP_Turbulence"); trans = this.transform; }
// Use this for initialization void Start() { rain = GetComponentsInChildren <Rain>(true)[0]; fog = GetComponentsInChildren <Fog>(true)[0]; snow = GetComponentsInChildren <Snow>(true)[0]; windZone = GetComponentsInChildren <WindZone>(true)[0]; }
public void UpdateWind(WindZone windZone, float windSpeedFactor) { Vector3 windDirection; float windStrength; float windTurbulence; if (windZone) { windDirection = windZone.transform.forward; windStrength = windZone.windMain * windSpeedFactor * WindSpeed; windStrength += windZone.windPulseMagnitude * (1.0f + Mathf.Sin(Time.time * windZone.windPulseFrequency) + 1.0f + Mathf.Sin(Time.time * windZone.windPulseFrequency * 3.0f)) * 0.5f; windTurbulence = windZone.windTurbulence * windZone.windMain * windSpeedFactor * WindSpeed; } else { windDirection = Vector3.forward; windStrength = 1 * windSpeedFactor * WindSpeed; windStrength += 1 * (1.0f + Mathf.Sin(Time.time) + 1.0f + Mathf.Sin(Time.time * 3.0f)) * 0.5f; windTurbulence = windSpeedFactor * WindSpeed; } windDirection.x *= windStrength; windDirection.y *= windStrength; windDirection.z *= windStrength; Shader.SetGlobalVector(_terrainLODWind, new Vector4(windDirection.x, windDirection.y, windDirection.z, windTurbulence)); }
public void StopWind(WindZone windZone) { if (windZone != null) { windZone.Stop(this, -1); } }
void Start() { windZone = GetComponent <WindZone>(); windSound = GetComponent <AudioSource>(); InvokeRepeating("WindIntensity", timer, changeRate); }
private void Start() { if (this.PlayableFXs == null || this.PlayableFXs.Count <= 0) { this.PlayableFXs = ((IEnumerable <SpriteToParticles>)Object.FindObjectsOfType <SpriteToParticles>()).ToList <SpriteToParticles>(); } if (this.PlayableFXs == null || this.PlayableFXs.Count <= 0) { Object.Destroy((Object)((Component)this).get_gameObject()); } else { if (!Object.op_Implicit((Object)this.wind)) { this.wind = (WindZone)Object.FindObjectOfType <WindZone>(); } if (!Object.op_Implicit((Object)this.wind)) { ((Component)this.WindButton).get_gameObject().SetActive(false); } foreach (SpriteToParticles playableFx in this.PlayableFXs) { if (Object.op_Implicit((Object)playableFx)) { playableFx.OnAvailableToPlay += new SimpleEvent(this.BecameAvailableToPlay); } } this.RefreshButtons(); } }
/// <summary> /// Check sanity of wanted references and attach BecameAvailableToPlay method to all emitters' OnAvailableToPlay event /// </summary> void Start() { if (PlayableFXs == null || PlayableFXs.Count <= 0) { PlayableFXs = FindObjectsOfType <SpriteToParticles>().ToList(); } if (PlayableFXs == null || PlayableFXs.Count <= 0) { Destroy(gameObject); return; } if (!wind) { wind = FindObjectOfType <WindZone>(); } if (!wind) { WindButton.gameObject.SetActive(false); } foreach (SpriteToParticles fx in PlayableFXs) { if (fx) { fx.OnAvailableToPlay += BecameAvailableToPlay; } } RefreshButtons(); }
// Use this for initialization void Start() { myWind = GetComponentInChildren <WindZone> (); skyParts1 = transform.GetChild(1).GetComponent <ParticleSystem> (); skyParts2 = transform.GetChild(2).GetComponent <ParticleSystem> (); myWave = GameObject.Find("WaveManager").GetComponent <Wave> (); //stormOn = false; myTimer = stormTimer + Random.Range(0f, stormVariance); partEmission = skyParts1.emission.rateOverTimeMultiplier; windStrength = myWind.windMain; if (stormOn) { myTimer = stormLength; ParticleSystem.EmissionModule emitter = skyParts1.emission; emitter.rateOverTimeMultiplier = partEmission * 25; emitter = skyParts2.emission; emitter.rateOverTimeMultiplier = partEmission * 25; myWind.windMain = windStrength * 4; myWave.AddWave(0f, 2f, 3f, 20f); myWave.AddWave(38f, 1.2f, -4.5f, 15f); } }
public static FWindSettings FromWindZone(WindZone windZone) => new FWindSettings() { WindStrength = windZone.windMain * 0.2f, WindSpeed = windZone.windPulseFrequency, Turbulence = windZone.windTurbulence * 0.2f, WindDirection = FWindSettings.RotationToDirection(windZone.transform.rotation) };
public void Awake() { Find.Any(out weatherService); #if UNITY_MODULES_WIND wind = GetComponent <WindZone>(); #endif }
private void Start() { _windZone = gameObject.GetComponent <WindZone>(); _windZone.windMain = 0; _coroutine = Retrigger(); StartCoroutine(_coroutine); }
public static Vector3 EvaluateWindForce(WindZone zone, Vector3 point) { float pulse = Pulse(Time.time, zone.windPulseFrequency) * zone.windPulseMagnitude; var turbulence = zone.windTurbulence * pulse * zone.transform.TransformDirection(new Vector3(Mathf.PerlinNoise(Time.time, 0) * .1f, Mathf.PerlinNoise(0, Time.time) * .1f, 1)).normalized; var windMain = zone.transform.forward * zone.windMain; return((windMain + turbulence) * .5f); }
public void FundamentalValueBasicWindVelocityTest_Success( double heightAboveSeaLevel, WindZone windZone, double expectedResult) { var terrain = new Mock <ITerrain>(); var buildingSite = new BuildingSite(heightAboveSeaLevel, windZone, terrain.Object); Assert.That(buildingSite.FundamentalValueBasicWindVelocity, Is.EqualTo(expectedResult)); }
void Start() { helicopter = GetComponentInParent <SingleMainRotorHelicopter> (); windZone = GetComponent <WindZone> (); origMain = windZone.windMain; origTurbulence = windZone.windTurbulence; origPulseMagnitude = windZone.windPulseMagnitude; }
public WindZone StartWind() { var windZone = new WindZone(); windZone.Init(this); windZone.Start(this); activeWeathers.Add(windZone); return(windZone); }
public static void Wind_Intensity(float mainIntensity) { WindZone windZone = GameObject.FindObjectOfType <WindZone>(); if (windZone) { windZone.windMain = mainIntensity; } }
// Start is called before the first frame update void Start() { rainScript = GetComponentInChildren <RainScript2D>(); windZone = GetComponentInChildren <WindZone>(); controlPoints = GetComponentsInChildren <RainControlPoint>(); camera = Camera.main; currentIndex = 1; seedRb = FindObjectOfType <Seed>().GetComponent <Rigidbody2D>(); }
public DirectionalFactor(WindZone windZone, double windDirection) { _windZone = windZone; if (windDirection < 0) { windDirection = 360 + windDirection % 360; } WindDirection = windDirection % 360; }
// Use this for initialization void Start() { wind = GetComponent <WindZone> (); /* * rig2 = GetComponent<Rigidbody> (); * rig2.isKinematic = true; */ }
// Use this for initialization void Start () { Destroy(this.gameObject, v_ShellLifetime); if (go_TravelWind == null) { go_TravelWind = transform.GetComponentInChildren<WindZone>(); } // if (v_ExplosionEffects == null) { v_ExplosionEffects = GameObject.Find("ExplosionEffects"); } // Destroy(this.gameObject, v_ShellLifetime); this.GetComponent<Rigidbody>().AddRelativeForce((Vector3.forward * v_ShellPropulsionForce), ForceMode.Impulse); }
private Vector3 GetAmplitude(WindZone wind, Vector3 dirrection) { angle += wind.windPulseFrequency; var noise = GetNoise(angle); var amplitude = wind.windMain + noise * wind.windPulseMagnitude; return(dirrection * amplitude); }
public WeatherModifier(WindZone windZone, ParticleSystem hail) { wind = windZone; this.hail = hail; main = hail.main; // Set relative position of weather this.hail.transform.localPosition += new Vector3(0, Globals.maxHeight); }
// Use this for initialization void Start() { windZone = this.GetComponent <WindZone>(); if (windZone) { float strength = WindStrength(Time.time * scale, windZone.windMain, windZone.windPulseMagnitude, windZone.windPulseFrequency); Vector3 dir = windZone.transform.forward * strength; windData = windDataLastFrame = new Vector4(dir.x, dir.y, dir.z, windZone.windTurbulence); } }
void Awake() { windZone = (WindZone)FindObjectOfType(typeof(WindZone)); if (!windZone) { windPulse = 1; windTurbulence = 1; windStrength = .1f; } }
public static void SetWindZone(WindZone windZone) { if (!Instance) { Debug.LogWarning("Tried to set Stylized Grass Renderer wind zone, but no instance is present"); return; } Instance.windZone = windZone; }
private void Awake() { windZone = GetComponent <WindZone>(); windZone.windMain = WindCurve.Evaluate(0); #if UNITY_2018_1_OR_NEWER //thanks unity for one more f*****g change of standard behaviour... windZone.windMain = -WindCurve.Evaluate(0); #else windZone.windMain = WindCurve.Evaluate(0); #endif }
static int _CreateWindZone(IntPtr L) { int count = LuaDLL.lua_gettop(L); if (count == 0) { WindZone obj = new WindZone(); LuaScriptMgr.Push(L, obj); return 1; } else { LuaDLL.luaL_error(L, "invalid arguments to method: WindZone.New"); } return 0; }
void Start() { cols = new Color[heights.Length]; if (wind_prob.Length<13){ Debug.LogError ("The length of wind gauge is faulty"); } float e_prob = 0; foreach(float x in wind_prob){ e_prob += x; } // generate weather forecast; for (int i = 0; i < heights.Length; i++) { float chance = Random.Range(0, e_prob); float cur_prob = 0; for (int j = 0; j < 13; j++) { cur_prob += wind_prob[j]; if (chance < cur_prob){ float angle = Random.Range(0,360) * Mathf.Deg2Rad; float x = Mathf.Sin (angle); float z = Mathf.Cos (angle); float mag = 1; if (j == 0){ mag = Random.Range(0, b_scale[0]); } else if (j == 12){ mag = Random.Range(b_scale[12], b_scale[12]+8); } else { mag = Random.Range(b_scale[j-1], b_scale[j]); } streams[i] = new Vector3(x * mag, heights[i], z * mag); Debug.Log(i+". Wind of strength " + j + " with magnitude "+mag+" results in "+streams[i]); cols[i] = scale_cols[j]; break; } } } zone = wind_zone.GetComponent<WindZone>(); }