override public bool Update(uint elapsed) { if (mBornEffectTime > 0) { mBornEffectTime -= (int)elapsed; if (mBornEffectTime <= 0) { OnBornEffectEnd(); } return(true); } if (mBornAniTime > 0) { mBornAniTime -= (int)elapsed; } cdTime -= (int)elapsed; if (0 > cdTime) { cdTime = 0; } if (IsDead()) { //死了状态机也得更新 UpdateMecanim(elapsed); /*GameScene scn = SceneManager.Instance.GetCurScene() as GameScene; * * if (scn == null) * return false; * * if (scn.GetCropsCanRelive()) * return true;*/ return(true); } if (mBloodNode != null) { Vector3 headPos = this.GetBonePositionByName("head"); if (headPos != Vector3.zero) { headPos = CameraController.Instance.WorldToScreenPoint(headPos); headPos.z = 0.0f; mBloodNode.Update(headPos, this.GetHP(), this.GetMaxHP()); } } UpdateTalk(elapsed); UpdateCrySound(elapsed); return(base.Update(elapsed)); }
override public bool Update(uint elapsed) { if (mBornEffectTime > 0) { mBornEffectTime -= (int)elapsed; if (mBornEffectTime <= 0) { OnBornEffectEnd(); } return(true); } if (mBornAniTime > 0) { mBornAniTime -= (int)elapsed; } cdTime -= (int)elapsed; if (0 > cdTime) { cdTime = 0; } if (IsDead()) { //死了状态机也得更新 UpdateMecanim(elapsed); return(false); } if (mLifeTime != uint.MaxValue) { if (mLifeTime > elapsed) { mLifeTime -= elapsed; } else { mLifeTime = uint.MaxValue; // NPC生命时间结束, 视为被系统回收. Die(new AttackerAttr(null)); return(false); } } if (mBloodNode != null) { Vector3 headPos = this.GetBonePositionByName("head"); if (headPos != Vector3.zero) { headPos = CameraController.Instance.WorldToScreenPoint(headPos); headPos.z = 0.0f; mBloodNode.Update(headPos, this.GetHP(), this.GetMaxHP()); } } UpdateTalk(elapsed); UpdateCrySound(elapsed); bool baseUpdate = base.Update(elapsed); //如果死了 等待多少秒后 删除 return(baseUpdate); }