Esempio n. 1
0
 public void OnBreak()
 {
     if (destroyedClip != null)
     {
         audioSourceMultichannel.GetChannel().PlayOneShot(destroyedClip);
     }
     isPlaced = true;
     Placed?.Invoke(false, transform.position);
     rigidbody2D.mass        = 10;
     snapOpen                = false;
     sprite.enabled          = false;
     breakingSprite.enabled  = false;
     brokenSprite.enabled    = true;
     highlightSprite.enabled = false;
     isHeld = false;
     placedTrigger.active         = false;
     placedTrigger.pickableObject = null;
     placedTrigger.canBePlaced    = false;
     brokeEffect.SetActive(true);
     brokeEffect.GetComponent <ParticleSystem>().Play();
     health = 0;
     Fallen?.Invoke();
     Broken?.Invoke();
     pickableTrigger.enabled = false;
     StartCoroutine(FadingOutBroken());
 }
Esempio n. 2
0
    IEnumerator CheckIfFalling()
    {
        while (this.transform.position.y > YCoordTreshold)
        {
            yield return(_updateWait);
        }

        Fallen?.Invoke();
    }
Esempio n. 3
0
    IEnumerator CheckIfFalling()
    {
        while (true)
        {
            if (this.transform.position.y < YCoordTreshold)
            {
                Fallen?.Invoke();
                break;
            }

            yield return(_updateWait);
        }
    }