Exemplo n.º 1
0
    void OnTriggerEnter(Collider collider)
    {
        switch (collider.gameObject.tag)
        {
        case "Coin":
            GameState.Score += GameState.CoinPoints;
            GameState.Collectables.Add(collider.gameObject);
            collider.gameObject.SetActive(false);
            SoundBoard.PlayCoin();
            break;

        case "Enemy":
            if (!GameState.PlayerInvincible)
            {
                GameState.Score -= GameState.EnemyPointLoss;
                if (GameState.Score < 0)
                {
                    GameState.Score = 0;
                }
                GameState.Collectables.Add(collider.gameObject);
                collider.gameObject.SetActive(false);
                GameState.StunTimer = GameState.StunTimerMax;
                SetColorByStatus();
                SoundBoard.PlayEnemy();
            }
            break;
        }
    }