コード例 #1
0
 private void OnTriggerStay2D(Collider2D collision)
 {
     if (collision.tag == "Door" && physicsComponent.CanExit())
     {
         if (physicsComponent.isGrabbingObject)
         {
             physicsComponent.ReleaseObject(false);
         }
         collision.GetComponent <DoorController>().OpenDoor();
     }
     if (collision.tag == "void")
     {
         if (!hasBeenDamagedRecently)
         {
             hasBeenDamagedRecently = true;
             stateComponent.RecieveDamage(1);
             StartCoroutine("ResetHasFallenToVoid");
         }
         if (physicsComponent.isGrabbingObject)
         {
             physicsComponent.ReleaseObject(false);
         }
         rb.velocity = new Vector2(0f, 0f);
         rb.position = stateComponent.iniPosition;
     }
 }