Exemple #1
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        if (gameStarted)
        {
            if (collision.tag == "wall")
            {
                rb.isKinematic = true;
                rb.simulated   = false;
                GameStats.SaveStats();
                flash.DoFlash();
                GameEnd();
            }

            if (collision.tag == "point")
            {
                GameStats.scoreCount++;
                Events.NotifyAboutPointGet();
            }

            if (collision.tag == "coin")
            {
                Destroy(collision.gameObject);
                GameStats.coinsCount++;
                Events.NotifyAboutUpdateStats();
            }
            Debug.Log(collision.name);
        }
    }
    void NewWave()
    {
        waveSpawner.Clear();
        flash.DoFlash();

        waveSpawner.SpawnWave();
        Invoke("ClearWave", waveDuration);
        Invoke("NewWave", waveDuration + wavePause);
    }