Пример #1
0
 private void OnMouseDown()
 {
     if (!_isFreezed)
     {
         clicksToDestroy--;
         if (clicksToDestroy <= 0)
         {
             gameProxy.AddScore(score);
             Destroy(gameObject);
         }
     }
 }
Пример #2
0
 private void OnMouseDown()
 {
     if (!_isFreezed)
     {
         clicksToDestroy--;
         HitEvent?.Invoke();
         if (clicksToDestroy <= 0)
         {
             gameProxy.AddScore(score);
             DieEvent?.Invoke();
             explodable.generateFragments();
             foreach (var fragment in explodable.fragments)
             {
                 fragment.AddComponent <ObjectCleaner>();
             }
             gameProxy.AddTime(timeAddedOnDestroy);
             gameProxy.ExplosionForce.doExplosion(transform.position);
             explodable.explode();
         }
     }
 }