private void Update() { float num = 0f; float cloackCoeff = 0f; float dissolveCoeff = 0f; EffectStates effectState = this.effectState; if (effectState == EffectStates.ACTIVATION) { this.timer += Time.deltaTime; num = this.timer / this.phaseTime; cloackCoeff = num - this.offsetPhaseTime; dissolveCoeff = num; this.ApplyTransition(this.dissolvingFrontCurve, dissolveCoeff, cloackCoeff); if (cloackCoeff >= 1f) { this.EffectState = EffectStates.WORKING; } } else if (effectState == EffectStates.DEACTIVATION) { this.timer -= Time.deltaTime; num = this.timer / this.phaseTime; dissolveCoeff = num; this.ApplyTransition(this.dissolvingBackCurve, dissolveCoeff, num - this.offsetPhaseTime); if (dissolveCoeff <= 0f) { this.EffectState = EffectStates.IDLE; } } }
private void MoveToNextState() { EffectStates curState = this.state; this.stateElapsed = 0; switch (curState) { case EffectStates.Initial: if (config.Delay > 0) { this.state = EffectStates.Delay; } else { this.state = EffectStates.Playing; Show(); OnBeginPlay(); PlayAudio(); } break; case EffectStates.Delay: this.state = EffectStates.Playing; Show(); OnBeginPlay(); PlayAudio(); break; case EffectStates.Playing: if (config.FadeOutTime > 0) { this.state = EffectStates.FadeOut; } else { this.state = EffectStates.Expired; Hide(); } OnEndPlay(); StopAudio(); break; case EffectStates.FadeOut: this.state = EffectStates.Expired; Hide(); break; } }
private void ResetState() { if (state == EffectStates.Initial) { return; } stateElapsed = 0; state = EffectStates.Initial; Hide(); StopAudio(); }
public void StopImmediate() { state = EffectStates.Expired; Hide(); if (companionEffects != null && companionEffects.Count > 0) { for (int i = 0; i < companionEffects.Count; i++) { companionEffects[i].StopImmediate(); } companionEffects.Clear(); } }
public void ConfigureEffect(Entity entity, bool fullInvisibly, params Renderer[] renderers) { this.entity = entity; this.timer = 0f; this.materials = new List <Material>(); foreach (Renderer renderer in renderers) { this.materials.AddRange(renderer.materials); } this.materialsLength = this.materials.Count; this.effectState = EffectStates.IDLE; this.dissolveCoeffIntKey = Shader.PropertyToID("_DissolveCoeff"); this.dissolveMapIntKey = Shader.PropertyToID("_DissolveMap"); this.distortionCoeffIntKey = Shader.PropertyToID("_DistortionCoeff"); if (fullInvisibly) { this.maxDistortion = 0f; } }
public State(EffectStates xtype, int duration) { type = xtype; turns_left = duration; }
private static void ExtractEffects(string path) { EffectStates state = EffectStates.Unknown; MultiMap <string, string> effects = new MultiMap <string, string>(); ClausewitzParser parser = new ClausewitzParser( name => { if (name == "effects") { if (state != EffectStates.Unknown) { throw new ClauzewitzSyntaxException("effects block inside " + state.ToString()); } state = EffectStates.Effects; } else if (name == "command") { if (state != EffectStates.Effects) { throw new ClauzewitzSyntaxException("command block inside " + state.ToString()); } state = EffectStates.Command; } }, () => { if (state == EffectStates.Command) { state = EffectStates.Effects; } else if (state == EffectStates.Effects) { state = EffectStates.Unknown; } }, (name, val) => { if (state != EffectStates.Command) { return; } effects.Add(name, val); }, val => { }); foreach (string filename in Directory.GetFiles(path)) { if (filename.EndsWith(@"\old_nuclear_tech.txt")) { continue; } parser.Parse(filename); } Console.WriteLine("Found the following effects:"); foreach (string key in effects.Keys) { Console.WriteLine(key + ":"); foreach (string val in effects.ValueList(key)) { Console.WriteLine("\t" + val); } } }
public void StopImmediate() { state = EffectStates.Expired; Hide(); }