Beispiel #1
0
    void Balloon_OnContact(object sender, Collision2D collision)
    {
        Balloon balloon = (Balloon)sender;

        if (collision.gameObject.layer == Values.PLAYER_LAYER)
        {
            if (collision.collider is CapsuleCollider2D)
            {
                if (balloon.hits == balloon.maxHits)
                {
                    if (balloon.balloonType == BalloonTypes.Normal)
                    {
                        if (m_HasSpecialBalloon == false)
                        {
                            m_SpecialPopCount++;
                            if (m_SpecialPopCount % m_PopsForSpecial == 0)
                            {
                                m_BalloonManager.SpawnBalloon(BalloonTypes.Special);
                                m_HasSpecialBalloon = true;
                            }
                        }
                    }
                    else
                    {
                        m_SpecialPopCount   = 0;
                        m_HasSpecialBalloon = false;
                        m_EffectsManager.DestroyFlowers();
                    }
                }
            }
        }
    }
 // Update is called once per frame
 void Update()
 {
     if (isInstructionPanelActive)
     {
         return;
     }
     balloonSpawnTimer += Time.deltaTime;
     if (balloonSpawnTimer >= spawnCooldown && !gameOver)
     {
         balloonSpawnTimer = 0;
         BalloonManager.SpawnBalloon();
     }
 }