Пример #1
0
    // --v-- Event Handler --v--

    private void HandleOnPlayerOnDestruction(EntityDestructionContext context)
    {
        if (context == EntityDestructionContext.DESTROYED_BY_DAMAGE)
        {
            OnGameIsOver?.Invoke();
            StopGame(_shouldPlayOutro);
        }
    }
Пример #2
0
        private void GameFinished()
        {
            IsGameOver = true;
            UnscheduleAll();
            _progressTimer.StopAllActions();

            //FIX THIS change sound
            PlayEffect(Sounds.GameOver);


            Device.BeginInvokeOnMainThread(() =>
            {
                OnGameIsOver?.Invoke(_score);
            });
            //this.Dispose();
        }
Пример #3
0
    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;
        }
    }
Пример #4
0
        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);
        }