// Stop the maze timer void OnTriggerEnter2D(Collider2D other) { MazeTimer timer = transform.parent.gameObject.GetComponent <MazeTimer>(); timer.TimerStop(); timer.Finish(); }
// Start the maze timer void OnTriggerEnter2D(Collider2D other) { // this.startTime = Time.time; MazeTimer timer = transform.parent.gameObject.GetComponent <MazeTimer>(); timer.TimerStart(); }
public LevelState(string name, int startLevel) : base(name) { Camera = new FirstPersonCamera(); Camera.BoundingRadius = 2.0f; Camera.UpdateBoundingVolumes(); YnG.ShowMouse = (GameConfiguration.EnabledMouse ? true : false); YnG.AudioManager.SoundEnabled = GameConfiguration.EnabledSound; YnG.AudioManager.MusicVolume = GameConfiguration.MusicVolume; groundPlayerBoundingSphere = new BoundingSphere(Camera.Position, Camera.BoundingRadius); _mazeLevel = new MazeLevel(startLevel); Add(_mazeLevel); _gameHUD = new GameHUD(); timeTimer = new MazeTimer(); score = new Score(startLevel); gameState = MazeGameState.Playing; elapsedPartyTime = 0; soundTimer = new YnTimer(1000, 0); if (YnG.AudioManager.SoundEnabled) { soundTimer.Completed += (s, e) => YnG.AudioManager.SoundEnabled = true; } else { soundTimer.Completed += (s, e) => { } }; control = new MazeController(Camera); Scene.SceneLight.AmbientIntensity = 0.85f; Scene.SceneLight.DirectionalLights[0].Enabled = true; Scene.SceneLight.DirectionalLights[0].Direction = new Vector3(-1, 0.75f, -1); Scene.SceneLight.DirectionalLights[0].DiffuseColor = Color.WhiteSmoke.ToVector3(); Scene.SceneLight.DirectionalLights[0].DiffuseIntensity = 1.0f; Scene.SceneLight.DirectionalLights[0].SpecularColor = new Vector3(233, 33, 33); }