示例#1
0
 //when ending collsion with a timeZone : remove its time modifier
 private void OnTriggerExit2D(Collider2D collision)
 {
     if (collision.tag == "TimeZone")
     {
         TimeZoneEffect timeZone = collision.GetComponent <TimeZoneEffect>();
         if (timeZone != null && timeZone.timeEffect > 0)
         {
             timeMultiplier /= timeZone.timeEffect;
         }
     }
 }
示例#2
0
 //when colliding with a timeZone : add its time modifier
 private void OnTriggerEnter2D(Collider2D collision)
 {
     Debug.Log("Collision !");
     if (collision.tag == "TimeZone")
     {
         Debug.Log("Collision2 !");
         TimeZoneEffect timeZone = collision.GetComponent <TimeZoneEffect>();
         if (timeZone != null && timeZone.timeEffect > 0)
         {
             timeMultiplier *= timeZone.timeEffect;
         }
     }
 }