示例#1
0
    void OnTriggerExit2D(Collider2D col)
    {
        HeartWeight w = col.gameObject.GetComponent <HeartWeight>();

        if (w != null)
        {
            currentWeight -= w.weight;
        }
    }
示例#2
0
 private void OnTriggerEnter2D(Collider2D other)
 {
     if (other.gameObject.CompareTag("heartPiece"))
     {
         HeartWeight w = other.gameObject.GetComponent <HeartWeight>();
         if (w != null)
         {
             currentWeight += w.weight;
         }
     }
 }