/// <summary> /// 死亡 /// </summary> public virtual void OnDead(DeadCommand ev) { StopPathFinding(); this.m_AnimController.Play("die"); Attrbute.UpdateValue(ActorAttributeType.Hp, 0); Attrbute.UpdateValue(ActorAttributeType.Mp, 0); this.Clear(); this.ApplyCharacterCtrl(false); this.m_ActorAI.Clear(); //DBEntiny db = ZTConfig.Instance.GetDBEntiny(Id); //if ((this is ActorMainPlayer) == false) //{ // LevelData.AllActors.Remove(this); //} //switch (ActorType) //{ // case EActorType.PLAYER: // if (this is ActorMainPlayer) // { // ZTLevel.Instance.OnMainPlayerDead(); // } // break; // case EActorType.MONSTER: // ZTEvent.FireEvent(EventID.RECV_KILL_MONSTER, GUID, Id); // ZTTimer.Instance.Register(1.5f, OnDeadEnd); // break; //} }
public bool UseMp(int use) { int mp = Attrbute.GetValue(ActorAttributeType.Mp); if (mp > use) { Attrbute.UpdateValue(ActorAttributeType.Mp, mp - use); UpdatePower(); return(true); } return(false); }
public bool UseHp(int use) { int hp = Attrbute.GetValue(ActorAttributeType.Hp); if (hp > use) { Attrbute.UpdateValue(ActorAttributeType.Hp, hp - use); UpdatePower(); return(true); } return(false); }
/// <summary> /// 死亡 /// </summary> public virtual void OnDead(DeadCommand ev) { StopPathFinding(); this.m_AnimController.Play("die"); Attrbute.UpdateValue(AttributeType.Hp, 0); Attrbute.UpdateValue(AttributeType.Mp, 0); this.ApplyCharacterCtrl(false); //播放死亡动画后删除 GameEntry.Timer.Register(3f, () => { GameEntry.Level.DelRole(this.Camp, this.EntityId); }); }
public virtual void TakeDamage(IActor attacker, int damage, bool strike) { ShowFlyword(strike ? FlyWordType.CritHurt : FlyWordType.Hurt, damage); int curHp = Attrbute.GetValue(ActorAttributeType.Hp); if (curHp > damage) { Attrbute.UpdateValue(ActorAttributeType.Hp, curHp - damage); } else { Attrbute.UpdateValue(ActorAttributeType.Hp, 0); } UpdateHealth(); if (curHp <= 0) { ExecuteCommand(new DeadCommand(ActorDeadType.Normal)); } }
public void AddMp(int mp, bool showFlyword) { if (IsDead) { return; } int newMp = Attrbute.GetValue(ActorAttributeType.Mp); if (newMp + mp > Attrbute.GetValue(ActorAttributeType.MaxMp)) { newMp = Attrbute.GetValue(ActorAttributeType.MaxMp); } else { newMp += mp; } Attrbute.UpdateValue(ActorAttributeType.Mp, newMp); if (showFlyword) { ShowFlyword(FlyWordType.MpHeal, mp); } this.UpdatePower(); }
public void AddHp(int hp, bool showFlyword) { if (IsDead) { return; } int newHp = Attrbute.GetValue(ActorAttributeType.Hp); if (newHp + hp > Attrbute.GetValue(ActorAttributeType.MaxHp)) { newHp = Attrbute.GetValue(ActorAttributeType.MaxHp); } else { newHp += hp; } Attrbute.UpdateValue(ActorAttributeType.Hp, newHp); if (showFlyword) { ShowFlyword(FlyWordType.HpHeal, hp); } this.UpdateHealth(); }