示例#1
0
 //Set player hp back to the max, record the position of the save point only if this save point isn't activated
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.gameObject.tag == "Player")
     {
         PlayerNew player = collision.gameObject.GetComponent <PlayerNew>();
         player.setSavePointPos(transform.position);
         if (!check)
         {
             player.hp = player.MaxHP;
             check     = true;
         }
         player.SetBattery(recoverBatteryNum);
         if (crushingWall != null)
         {
             crushingWall.SaveWallState();
         }
         GameManager.gm.SaveDoor();
         GameManager.gm.SaveKey();
         GameManager.gm.ShowSaveText();
     }
 }