public void OnStart() { rand = new Random(); myZone = gameObject.RequireComponent <CZone>(); //mySound.AddSound("RadioStatic.vente"); //mySound.AddSound("BeginOutro.vente"); //mySound.AddSound("Heartbeat.vente"); //mySound.Loop(true, "static.vente"); mySound = gameObject.RequireComponent <CSound>(); //mySound.PlayIndependentEvent("static.vente"); smc = new StateMachineController(); unactive = new State(smc, null, State_unactive_Update, null); lightson = new State(smc, State_lightson_Start, State_lightson_Update, null, 1.0f); lightsoff = new State(smc, State_lightsoff_Start, null, null, 1.0f, lightson); lightsonwait = new State(smc, null, null, null, 1.0f, lightsoff); lightson.NextState = lightson; smc.SetState(unactive); foreach (GameObject g in GameObject.GetGameObjectsWithTag("TLight")) { lights.Add(g.RequireComponent <CLight>()); g.RequireComponent <CSound>(); //.AddSound("LightTurnOn.vente"); } foreach (GameObject g in GameObject.GetGameObjectsWithTag("FlickerLight")) { GetScriptClass <LightFlicker>(g).activated = true; } MonsterEncounter1 me = GetScript <MonsterEncounter1>(GameObject.GetGameObjectByName("Monster1")); me.gameObject.RequireComponent <CMeshRenderer>().setEnabled(false); }
public void State_lightson_Start() { MonsterEncounter1 me = GetScript <MonsterEncounter1>(GameObject.GetGameObjectByName("Monster1")); if (current_light == 0) { lightson.MaxTimeInState = (float)rand.NextDouble() + 0.4f; } if (current_light < lights.Count) { CLight light = lights[current_light]; light.setEnabled(true); CSound sound = light.gameObject.RequireComponent <CSound>(); sound.PlayIndependentEvent("LightTurnOn.vente", false, 1); } else { if (!me.gameObject.RequireComponent <CMeshRenderer>().isEnabled()) { lightson.MaxTimeInState = (float)rand.NextDouble() * 15.0f + 5.0f; } lightson.NextState = lightsoff; return; } current_light++; }
public void State_lightsoff_Start() { MonsterEncounter1 me = GetScript <MonsterEncounter1>(GameObject.GetGameObjectByName("Monster1")); if (me.gameObject.RequireComponent <CMeshRenderer>().isEnabled()) { //load demo subject redacted Map.LoadMap("Assets/Levels/logo_stinger.mocha"); return; } me.gameObject.RequireComponent <CMeshRenderer>().setEnabled(false); //if (rand.Next(0,15) == 5) { me.gameObject.RequireComponent <CMeshRenderer>().setEnabled(true); me.Rotate(); } lightson.NextState = lightson; lightsoff.MaxTimeInState = ((float)rand.NextDouble() * 8.0f) + 1.0f; current_light = 0; foreach (CLight l in lights) { l.setEnabled(false); } }
public void State_lightson_Start() { if (current_light < lights.Count) { CLight light = lights[current_light]; light.setEnabled(true); CSound sound = light.gameObject.RequireComponent <CSound>(); sound.PlayIndependentEvent("LightTurnOn.vente", false, 1); } else { if (stage == 1) { foreach (GameObject g in GameObject.GetGameObjectsWithTag("FlickerLight")) { GetScriptClass <LightFlicker>(g).activated = true; } } //active monster lightson.MaxTimeInState = _lightson[stage]; if (stage != 0) { MonsterEncounter1 me = GetScript <MonsterEncounter1>(GameObject.GetGameObjectByName("Level4Monster1")); me.Advance(); if (me.gameObject.transform.position.z < 20) { lightsoff.NextState = finale; lightsoff.MaxTimeInState = 5.0f; } smc.SetState(lightsoff); } else { MonsterEncounter1 me = GetScript <MonsterEncounter1>(GameObject.GetGameObjectByName("Level4Monster1")); me.Advance(); smc.SetState(lightsonwait); } return; } current_light++; }