Exemplo n.º 1
0
 void OnCollisionEnter2D(Collision2D other)
 {
     if (other.gameObject.CompareTag("Neutron"))
     {
         Neutron neutron = other.gameObject.GetComponent <Neutron>();
         float   chance  = 1f / (float)neutron.speedLevel;
         if (chance >= Random.value)
         {
             Destroy(other.gameObject);
             Fission();
         }
         else
         {
             neutron.Bounce(other.GetContact(0).normal);
         }
     }
 }