public CharacterAttr(IAttrStrategy _attrStrategy, CharacterBaseAttr _baseAttr, int _lv = 1, float _critRate = 0) { AttrStrategy = _attrStrategy; BaseAttr = _baseAttr; Lv = _lv; CritRate = _critRate; DmgDescValue = AttrStrategy.GetDmgDescValue(Lv); }
public ICharacterAttr(IAttrStrategy strategy, int lv, CharactorBaseAttr baseAttr) { mLv = lv; mBaseAttr = baseAttr; mAttrStrategy = strategy; mDmgDescValue = mAttrStrategy.GetDmgDescValue(mLv); mCurHp = mBaseAttr.MaxHp + mAttrStrategy.GetExtraHPValue(mLv); }
public ICharacterAttr(IAttrStrategy strategy, int lv, CharacterBaseAttr baseAttr) { mLv = lv; mBaseAttr = baseAttr; mStrategy = strategy; mDmgDescValue = mStrategy.GetDmgDescValue(mLv); mCurrentHP = baseAttr.maxHP + mStrategy.GetExtraHPValue(mLv); }
/// <summary> /// 计算伤害 /// </summary> /// <param name="attacker"></param> public void CalDmgValue(ICharacter attacker) { int AtkValue = attacker.GetAtkValue(); AtkValue -= m_AttrStrategy.GetDmgDescValue(this); m_NowHP -= AtkValue; }
public ICharacterAttr(IAttrStrategy strategy, int lv, CharacterBaseAttr baseAttr) { mBaseAttr = baseAttr; mLv = lv; mStrategy = strategy; //下面的两个字段当角色被创建出来的时候就已经确定了,所以在构造方法里面直接进行初始化 mDmgDescValue = mStrategy.GetDmgDescValue(mLv); mCurrentHP = baseAttr.maxHP + mStrategy.GetExtraHPValue(mLv); }
public ICharacterAttribute(IAttrStrategy strategy, int level, CharacterBaseAttr baseAttr) { mBaseAttr = baseAttr; mLevel = level; mStrategy = strategy; mDmgDescValue = mStrategy.GetDmgDescValue(mLevel); mCurretHP = baseAttr.maxHP + mStrategy.GetExtraHPVaule(mLevel); }
//public int DmgDescValue { get { return m_DmgDescValue; } } //不使用方法返回是为了减少性能损耗 //public int DmgDescValue { get { return m_Strategy.GetDmgDescValue(m_LV); } } public ICharacterAttr(IAttrStrategy strategy, int lv, CharacterBaseAttr baseAttr) { m_Strategy = strategy; m_LV = lv; m_BaseAttr = baseAttr; m_DmgDescValue = m_Strategy.GetDmgDescValue(m_LV); m_CurrentHP = baseAttr.MaxHP + m_Strategy.GetExtraHPValue(m_LV); }
public ICharacterAttr(IAttrStrategy strategy, int lv, CharacterBaseAttr baseAttr) { mStrategy = strategy; mLv = lv; mCharacterBaseAttr = baseAttr; mDmgDesValue = mStrategy.GetDmgDescValue(mLv); //根据等级计算出抵御的伤害值 mCurrentHP = baseAttr.MaxHP + mStrategy.GetExtraHPValue(mLv); //根据等级计算额外血量,加最大血量得到当前角色血量 }
//获取被武器攻击后的伤害 public void CalDmgValue(ICharacter attacker) { //获取武器攻击力 int atkValue = attacker.GetAtkValue(); //减少伤害值 atkValue -= attrStrategy.GetDmgDescValue(this); //扣去伤害值 nowHP -= atkValue; }
// 取得被武器攻擊後的傷害值 public void CalDmgValue(ICharacter Attacker) { // 取得武器功擊力 int AtkValue = Attacker.GetAtkValue(); // 減傷 AtkValue -= m_AttrStrategy.GetDmgDescValue(this); // 扣去傷害 m_NowHP -= AtkValue; }
//获取被武器攻击后的伤害值 public void CalDmgValue(ICharacter Attacker) { //获取武器攻击力 int AtkValue = Attacker.GetAtkValue(); //减少伤害值 AtkValue -= m_AttrStrategy.GetDmgDescValue(this); //扣去伤害值 m_NowHP -= AtkValue; }
//public ICharacterAttr(IAttrStrategy strategy,int lv, string name,int maxHP,float moveSpeed,string iconSprite,string prefabName) public ICharacterAttr(IAttrStrategy strategy, int lv, CharacterBaseAttr baseAttr) { mBaseAttr = baseAttr; mLv = lv; mStrategy = strategy; mDmgDescValue = mStrategy.GetDmgDescValue(mLv); mCurrentHP = mBaseAttr.maxHP + mStrategy.GetEXtraHPValue(mLv); //mName = name; //mMaxHP = maxHP; //mMoveSpeed = moveSpeed; //mIconSprite = iconSprite; //mPrefabName = prefabName; }