bool isActivated = false; // has player stepped into the area public override void OnStart() { base.OnStart(); mSound = gameObject.RequireComponent <CSound>(); flickeringLights = new List <CLight>(); GameObject lightObj = GameObject.GetGameObjectByName("LightFlicker"); CLight flickeringLight = lightObj.RequireComponent <CLight>(); originalIntensity = flickeringLight.GetAtt(); flickeringLights.Add(flickeringLight); for (int index = 2; index <= 6; ++index) { string lightName = "LightFlicker " + index.ToString(); lightObj = GameObject.GetGameObjectByName(lightName); flickeringLight = lightObj.RequireComponent <CLight>(); flickeringLights.Add(flickeringLight); } foreach (CLight light in flickeringLights) { light.setEnabled(false); // Turn off all lights at start } glass = GameObject.GetGameObjectByName("GlassMonster"); glassScript = GetScript <TutorialGlassSound>(glass); monster = GameObject.GetGameObjectByName("Monster"); monsterInitPos = monster.transform.position; GameObject doorObj = GameObject.GetGameObjectByName("door6"); door = GetScript <DoorMain>(doorObj); mDirectionToRun = gameObject.transform.GetForwardVector(); mDirectionTowardGlass = gameObject.transform.GetRightVector(); }
public override void OnStart() { base.OnStart(); mSound = gameObject.RequireComponent<CSound>(); flickeringLights = new List<CLight>(); GameObject lightObj = GameObject.GetGameObjectByName("LightFlicker"); CLight flickeringLight = lightObj.RequireComponent<CLight>(); originalIntensity = flickeringLight.GetAtt(); flickeringLights.Add(flickeringLight); for (int index = 2; index <= 6; ++index) { string lightName = "LightFlicker " + index.ToString(); lightObj = GameObject.GetGameObjectByName(lightName); flickeringLight = lightObj.RequireComponent<CLight>(); flickeringLights.Add(flickeringLight); } foreach (CLight light in flickeringLights) { light.setEnabled(false); // Turn off all lights at start } glass = GameObject.GetGameObjectByName("GlassMonster"); glassScript = GetScript<TutorialGlassSound>(glass); monster = GameObject.GetGameObjectByName("Monster"); monsterInitPos = monster.transform.position; GameObject doorObj = GameObject.GetGameObjectByName("door6"); door = GetScript<DoorMain>(doorObj); mDirectionToRun = gameObject.transform.GetForwardVector(); mDirectionTowardGlass = gameObject.transform.GetRightVector(); }