/// <summary> /// 实体死亡时回调,判断游戏胜利失败 /// </summary> /// <param name="obj">实体</param> public void CheckDeath(EntityManager obj) { obj.OnObjectDeath -= CheckDeath; //删除回调函数 Debug.Log(obj.name); if (obj.CompareTag("Player")) { Debug.Log("player dead"); playerDead = true; controlUI.SetActive(false); deathUI.SetActive(true); gameHasEnd = true; } else if (obj.CompareTag("enemy")) { enemyCount--; if (enemyCount == 0) { if (spawnRightAfterWin) { door.Spawn(); } } } }