Beispiel #1
0
 void OnCollisionEnter(Collision other)
 {
     if (other.collider.tag == "Obstacle")
     {
         for (int i = 0; i < 3; i++)
         {
             NewParticle();
         }
         Instantiate(_animation, transform.position, new Quaternion(0f, 0f, 0f, 0f));
         _audio.DestroySound();
         Destroy(this.gameObject);
     }
 }
 void OnCollisionEnter(Collision other)
 {
     if (Mathf.Abs(other.relativeVelocity.y) > 3f)
     {
         gameObject.GetComponent <SpriteRenderer>().sprite = _damagesprite;
         for (int i = 0; i < 3; i++)
         {
             NewParticle();
         }
     }
     if (Mathf.Abs(other.relativeVelocity.y) > 6f)
     {
         Destroy(this.gameObject);
         _audio.DestroySound();
     }
 }
 void OnCollisionEnter(Collision other)
 {
     if (Mathf.Abs(other.relativeVelocity.y) > 3f)
     {
         gameObject.GetComponent <SpriteRenderer>().sprite = _damagesprite;
         NewParticle();
         Instantiate(_particle, new Vector3(transform.position.x, transform.position.y, -1f), Quaternion.Euler(0f, 0f, Random.Range(0f, 359f)));
         NewParticle();
         Instantiate(_particle, new Vector3(transform.position.x, transform.position.y, -1f), Quaternion.Euler(0f, 0f, Random.Range(0f, 359f)));
         NewParticle();
         Instantiate(_particle, new Vector3(transform.position.x, transform.position.y, -1f), Quaternion.Euler(0f, 0f, Random.Range(0f, 359f)));
     }
     if (Mathf.Abs(other.relativeVelocity.y) > 6f)
     {
         Destroy(this.gameObject);
         _audio.DestroySound();
     }
 }
Beispiel #4
0
 void OnCollisionEnter(Collision other)
 {
     if (Mathf.Abs(other.relativeVelocity.y) > 3f)
     {
         GameObject _sprite = this.gameObject.transform.GetChild(0).gameObject;
         NewParticle();
         Instantiate(_particle, new Vector3(transform.position.x, transform.position.y, -1f), Quaternion.Euler(0f, 0f, Random.Range(0f, 359f)));
         NewParticle();
         Instantiate(_particle, new Vector3(transform.position.x, transform.position.y, -1f), Quaternion.Euler(0f, 0f, Random.Range(0f, 359f)));
         NewParticle();
         Instantiate(_particle, new Vector3(transform.position.x, transform.position.y, -1f), Quaternion.Euler(0f, 0f, Random.Range(0f, 359f)));
     }
     if (Mathf.Abs(other.relativeVelocity.y) > 6f)
     {
         Destroy(this.gameObject);
         _audio.DestroySound();
     }
 }