Exemplo n.º 1
0
 /// <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;
     //}
 }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
        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);
        }
Exemplo n.º 4
0
        /// <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);
            });
        }
Exemplo n.º 5
0
        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));
            }
        }
Exemplo n.º 6
0
        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();
        }
Exemplo n.º 7
0
        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();
        }