Example #1
0
 private void OnTriggerEnter(Collider other)
 {
     if (other.gameObject.name == "Main Cube")
     {
         mainCharacter character = other.gameObject.GetComponent <mainCharacter>();
         if (!character.isPowerful())
         {
             character.becomePowerful(timeActive);
             Destroy(gameObject);
         }
     }
 }
Example #2
0
 private void OnCollisionEnter(Collision collision)
 {
     speed = 0 - speed;
     if (collision.gameObject.name == "Main Cube")
     {
         mainCharacter mc = collision.gameObject.GetComponent <mainCharacter>();
         if (mc.isPowerful())
         {
             Destroy(this.gameObject);
         }
         else
         {
             mc.decreaseLives();
         }
     }
 }