Exemple #1
0
 private void OnTriggerEnter(Collider other)
 {
     if (inGame)
     {
         if (other.gameObject.tag == "Bonus")
         {
             if (other.gameObject.GetComponent <Bonus>())
             {
                 Bonus bonus = other.gameObject.GetComponent <Bonus>();
                 if (bonus.bonusType == Bonus.BonusType.levitation)
                 {
                     levitationTimer.StartTimer(bonus.effect.effectTime);
                 }
                 if (bonus.bonusType == Bonus.BonusType.bombCountBonus)
                 {
                     bombBonus?.Invoke(bonus.effect);
                 }
                 if (bonus.bonusType == Bonus.BonusType.removeAllDangers)
                 {
                     noDangerTimer.StartTimer(bonus.effect.effectTime);
                 }
                 if (bonus.bonusType == Bonus.BonusType.magnet)
                 {
                     magnetTimer.StartTimer(bonus.effect.effectTime);
                 }
                 if (bonus.bonusType == Bonus.BonusType.antiBonus)
                 {
                     RemoveAllBonuses();
                 }
                 bonus.StartTimer();
             }
         }
     }
 }
Exemple #2
0
    public void BombPlaced()
    {
        Vector3 pos = transform.position;

        Collider[] colliders = Physics.OverlapSphere(pos, radius);
        foreach (Collider hit in colliders)
        {
            Rigidbody rb = hit.GetComponent <Rigidbody>();

            if (rb != null)
            {
                rb.AddExplosionForce(power, pos, radius, upwardsModifier);
            }
            if (hit.gameObject.name == "Player")
            {
                onMove?.Invoke();
            }
            explosionTimer.StartTimer();
            if (GameSettings.sfxOn)
            {
                transform.GetChild(0).gameObject.SetActive(true);
            }
        }
    }
Exemple #3
0
 public void StartTimer()
 {
     timerNode.StartTimer();
 }