// Update is called once per frame void Update() { if (IsDead && TimeCounter < ResurrectionTime) { TimeCounter += Time.deltaTime; //Debug.Log("Dead and Wait"); } else if (IsDead && TimeCounter >= ResurrectionTime) { HPRemain = HP; TimeCounter = 0; IsDead = false; gameObject.transform.position = StrongHoldPosition; GetComponent <NavMeshAgent>().enabled = true; //Debug.Log("Dead and Already"); } if (HPRemain > 0 && !IsDead) { Action(); //Debug.Log("Alive and moving"); } else if (HPRemain <= 0 && !IsDead)//生命值为0但不是未死状态 { IsDead = true; MissionChecker(); Debug.Log("awsl"); ResourceController.CreateObject(this.gameObject, transform.position, transform.rotation); this.transform.position = VeryFar; GetComponent <NavMeshAgent>().enabled = false; //Debug.Log("Alive but Already to Dead"); } }