示例#1
0
 private void OnGameOver()
 {
     Debug.Log("GAME OVERRR");
     sfxManager.Lose.PlayRandom();
     gameOver.SetActive(true);
     GameFinishedEvent?.Invoke(false);
     MatrixExit(false, 8f);
 }
示例#2
0
        private void OnTrackListFinished()
        {
            reachedEnd = true;
            youWin.SetActive(true);
            GameFinishedEvent?.Invoke(true);

            MatrixExit(true, 8);
            Debug.Log("Success! Last Track Finished!");
        }
示例#3
0
    public void DestroyAllBlocks()
    {
        var blocks = GameObject.FindGameObjectsWithTag("Block");

        foreach (var block in blocks)
        {
            Destroy(block);
        }

        _blockCount = 0;
        if (_blockCount <= 0)
        {
            GameFinishedEvent?.Invoke();
        }
    }
示例#4
0
    private void State_End()
    {
        // update the player data object with the players name
        PlayerData.PlayerName = playerNameText;

        // we no-longer care if the button has been clicked, remove the listener
        playerNameAcceptButton.onClick.RemoveAllListeners();

        // reset our state for the next run
        currentState = States.PreStart;

        // let those listening know that we want to view high scores
        if (GameFinishedEvent != null)
        {
            GameFinishedEvent.Invoke();
        }

        // we are proceeding into the next part of the game, these views are no-longer needed
        HideAllViews();
    }
示例#5
0
    public void DestroyBlock(GameObject receivedBlock)
    {
        if (!receivedBlock.CompareTag("Block"))
        {
            return;
        }

        Destroy(receivedBlock);
        _blockCount--;

        AudioManager.Instance.PlayBlockDestroyedSound();

        var particles = Instantiate(DestroyingParticles, receivedBlock.transform.position, receivedBlock.transform.rotation);

        particles.GetComponent <ParticleSystem>().Play();
        Destroy(particles, 1f);

        _doubleBallBonus.Execute();
        _slowMoBallBonus.Execute();

        var receivedBlockId = receivedBlock.GetComponent <BlockId>().Id;

        var blockForRemove = CurrentLevelState.BlocksList.FirstOrDefault(t => t.Id == receivedBlockId);

        CurrentLevelState.BlocksList.Remove(blockForRemove);

        var amount = CurrentLevel.BlocksList
                     .Where(t => t.Id == receivedBlockId)
                     .Select(t => t.BlockScoreCost).FirstOrDefault();


        Score.AddAmountToScore(amount);

        if (_blockCount <= 0)
        {
            GameFinishedEvent?.Invoke();
        }
    }