// --v-- Event Handler --v-- private void HandleOnPlayerOnDestruction(EntityDestructionContext context) { if (context == EntityDestructionContext.DESTROYED_BY_DAMAGE) { OnGameIsOver?.Invoke(); StopGame(_shouldPlayOutro); } }
private void GameFinished() { IsGameOver = true; UnscheduleAll(); _progressTimer.StopAllActions(); //FIX THIS change sound PlayEffect(Sounds.GameOver); Device.BeginInvokeOnMainThread(() => { OnGameIsOver?.Invoke(_score); }); //this.Dispose(); }
private void Update() { if (Input.GetKeyDown(KeyCode.Space)) { FreezeUnfreezeBall(); } if (!GameIsOver && castle.HealthComponent.CurrentHealth <= 0) { GameIsOver = true; GameIsOn = false; OnGameIsOver.Invoke(); } if (GameIsOn && !GameIsOver) { gameTime += Time.deltaTime; } }
private void GameOver() { UnscheduleAll(); StopAllActions(); PlayEffect(Sounds.GameOver); _progressTimer.Visible = false; WriteGameOver(); //do game over animation ScheduleOnce(a => { Device.BeginInvokeOnMainThread(() => { OnGameIsOver?.Invoke(_score); }); }, 1.5f); }