Exemplo n.º 1
0
 private void DestroyBlock()
 {
     gameStatus.AddPoints();
     AudioSource.PlayClipAtPoint(breakSound, Camera.main.transform.position);
     Destroy(gameObject);
     level.BlockDestroyed();
     gameStatus.SpeedUp();
 }
Exemplo n.º 2
0
    private void OnTriggerEnter2D(Collider2D otherCollider)
    {
        GameObject otherGameObject = otherCollider.gameObject.transform.parent.gameObject;

        if (otherGameObject.tag == BouncingObject)
        {
            AudioClip clip = bounceSuccessSound[Random.Range(0, bounceSuccessSound.Length - 1)];
            AudioSource.PlayClipAtPoint(clip, transform.position, bounceSuccessSoundVolume);

            gameSession.AddToScore(1);
            gameSession.AddPoints(1);
            Destroy(otherGameObject);
        }
    }
Exemplo n.º 3
0
    void OnTriggerEnter2D(Collider2D collision)
    {
        Player        player        = FindObjectOfType <Player>();
        AudioListener audioListener = FindObjectOfType <AudioListener>();

        if (!isPickedUp &&
            player.isAlive &&
            collision != player.GetComponent <CircleCollider2D>())
        {
            GameSession gameSession = FindObjectOfType <GameSession>();
            gameSession.AddPoints(points);
            AudioSource.PlayClipAtPoint(musicNoteSFX, audioListener.transform.position);
            Destroy(gameObject);
            isPickedUp = true;
        }
    }
Exemplo n.º 4
0
 private void AddPoints()
 {
     _gameSession.AddPoints();
 }