private void OnUpgradeLevel() { this.ActorCard.SetLevel(); RefreshBoardEventArgs eventArgs = ReferencePool.Acquire <RefreshBoardEventArgs>(); int maxHp = Attrbute.GetValue(AttributeType.MaxHp); int curHp = Attrbute.GetValue(AttributeType.Hp); eventArgs.Fill(EntityId, maxHp, curHp, ActorCard.Level); GameEntry.Event.Fire(this, eventArgs); RefreshHeroInfoEventArgs args = ReferencePool.Acquire <RefreshHeroInfoEventArgs>().FillLevel(ActorCard.Level); GameEntry.Event.Fire(this, args); int id = GameEntry.Entity.GenerateTempSerialId(); EffectData data = new EffectData(id, Constant.Define.LevelUpEffect); data.Owner = this; data.KeepTime = 3; data.BindType = EffectBindType.OwnFoot; data.DeadType = FlyObjDeadType.UntilLifeTimeEnd; data.Parent = CachedTransform; data.SetParent = true; GameEntry.Entity.ShowEffect(data); }
/// <summary> /// 重生 /// </summary> public void OnReborn() { AddHp(Attrbute.GetValue(AttributeType.MaxHp), false); AddMp(Attrbute.GetValue(AttributeType.MaxMp), false); m_CharacterController.enabled = true; m_AnimController.Play("fuhuo", GotoEmptyFsm, false); }
public override void Init() { base.Init(); GameEntry.Event.Subscribe(ChangeEquipEventArgs.EventId, ChangeEquipAvatar); GameEntry.Event.Subscribe(SkillKeyDownEventArgs.EventId, TryUseSkill); GameEntry.Event.Subscribe(KillMonsterEventArgs.EventId, OnKillMonster); GameEntry.Event.Subscribe(ChangeAiModeEventArgs.EventId, OnChangeAiMode); GameEntry.Event.Subscribe(ChangeVehicleEventArgs.EventId, OnChangeVehicle); GameEntry.Event.Subscribe(ChangePartnerEventArgs.EventId, OnChangePartner); m_OriginalParent = CachedTransform.parent; m_Vehicle = this; BattleState = false; RefreshBoardEventArgs eventArgs = ReferencePool.Acquire <RefreshBoardEventArgs>(); int maxHp = Attrbute.GetValue(AttributeType.MaxHp); int curHp = Attrbute.GetValue(AttributeType.Hp); eventArgs.Fill(EntityId, maxHp, curHp, ActorCard.Level); GameEntry.Event.Fire(this, eventArgs); BroadcastHeroInfo(); InitPartner(); GameEntry.Level.CreatePlayerActor(this); }
public bool IsFullHp() { int hp = Attrbute.GetValue(ActorAttributeType.Hp); int maxHp = Attrbute.GetValue(ActorAttributeType.MaxHp); return(hp >= maxHp); }
public bool IsFullMp() { int mp = Attrbute.GetValue(ActorAttributeType.Mp); int maxMp = Attrbute.GetValue(ActorAttributeType.MaxMp); return(mp >= maxMp); }
protected override void UpdateHealth() { int maxHp = Attrbute.GetValue(AttributeType.MaxHp); int curHp = Attrbute.GetValue(AttributeType.Hp); RefreshHeroInfoEventArgs args = ReferencePool.Acquire <RefreshHeroInfoEventArgs>().FillHp(curHp, maxHp); GameEntry.Event.Fire(this, args); }
protected override void UpdatePower() { base.UpdatePower(); int maxMp = Attrbute.GetValue(AttributeType.MaxMp); int curMp = Attrbute.GetValue(AttributeType.Mp); RefreshHeroInfoEventArgs args = ReferencePool.Acquire <RefreshHeroInfoEventArgs>().FillMp(curMp, maxMp); GameEntry.Event.Fire(this, args); }
/// <summary> /// 强制移动 /// </summary> public virtual void OnForceToMove(MoveCommand ev) { StopPathFinding(); Vector3 delta = ev.Delta; int speed = Attrbute.GetValue(AttributeType.Speed); CachedTransform.LookAt(new Vector3(CachedTransform.position.x + delta.x, CachedTransform.position.y, CachedTransform.position.z + delta.y)); m_CharacterController.SimpleMove(m_CharacterController.transform.forward * speed); this.m_AnimController.Play("run", null, true); }
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); }
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(); }