public override CharacterAttr AddCharacterAttr() { CharacterBaseAttr baseAttr = FactoryManager.AttrFactory.GetCharacterBaseAttr(t); SoldierAttr attr = new SoldierAttr(new SoldierAttrStrategy(), baseAttr, lv); return(attr); }
public ICharacterAttr(IAttrStrategy strategy, int lv, CharacterBaseAttr baseAttr) { mLv = lv; mBaseAttr = baseAttr; mStrategy = strategy; mDmgDescValue = mStrategy.GetCritDmg(mLv); mCurrentHP = baseAttr.MaxHP + mStrategy.GetExtralHPValue(mLv); }
public ICharacterAttr(IAttrStrategy strategy, int lv, CharacterBaseAttr baseAttr) { mLv = lv; mBaseAttr = baseAttr; mAttrStrategy = strategy; mDmgDescValue = mAttrStrategy.GetDmgDescValue(mLv); mCurrentHp = baseAttr.maxHP + mAttrStrategy.GetExtraHP(mLv); }
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 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 override void AddCharacterAttr() { CharacterBaseAttr baseAttr = FactoryManager.AttrFactory.GetCharacterBaseAttr(m_CharacterType); m_PrefabName = baseAttr.PrefabName; ICharacterAttr attr = new EnemyAttr(new EnemyAttrStategy(), m_LV, baseAttr); m_Character.Attr = attr; }
public override void AddCharacterAttr() { CharacterBaseAttr baseAttr = FactoryManager.attrFactory.GetCharacterBaseAttr(mType); mPrefabName = baseAttr.prefabName; ICharacterAttribute attr = new EnemyAttribute(new EnemyAttrStrategy(), mLevel, baseAttr); mCharacter.Attr = attr; }
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 ICharacterAttr(IAttrStrategy strategy, int lv, CharacterBaseAttr baseAttr) { mStrategy = strategy; mLv = lv; mCharacterBaseAttr = baseAttr; mDmgDesValue = mStrategy.GetDmgDescValue(mLv); //根据等级计算出抵御的伤害值 mCurrentHP = baseAttr.MaxHP + mStrategy.GetExtraHPValue(mLv); //根据等级计算额外血量,加最大血量得到当前角色血量 }
public override void AddCharacterAttr() { CharacterBaseAttr baseAttr = FactoryManager.attrFactory.GetCharacterBaseAttr(mT); mPrefabName = baseAttr.prefabName; ICharacterAttr attr = new SoldierAttr(new SoldierAttrStrategy(), mLv, baseAttr); mCharacter.attr = attr; }
public override void AddCharacterAttr() { CharacterBaseAttr enemyBaseAttr = FactoryManager.GetAttrFactory.GetCharacterBaseAttr(mT); mPrefabName = enemyBaseAttr.PrefabName;//下方添加角色需要prefabName; ICharacterAttr attr = new EnemyAttr(new EnemyAttrStrategy(), mLv, enemyBaseAttr); mCharacter.Attr = attr; }
public CharacterBaseAttr GetCharacterBaseAttr(Type t) { CharacterBaseAttr attr = null; if (!characterBaseAttrDic.TryGetValue(t, out attr)) { Debug.Log("无法得到 CharacterBase T 的基础属性"); return(null); } return(attr); }
public override void AddCharacterAttr() { CharacterBaseAttr baseAttr = FactoryManager.attrFactory.GetCharacterBaseAttr(mCharacterID); mPrefabName = baseAttr.prefabName; IAttrStrategy attrStrategy = new HelicopterAttrStrategy(); //mSpawnLocalEuler = attrStrategy.GetEulerAngle(mCharacterRefreshPO); HelicopterAttr attr = new HelicopterAttr(attrStrategy, baseAttr); mCharacter.attr = attr; mCharacter.InitRefreshData(E_ActionType.UnKonw, null, 1, -1); }
public override void AddCharacterAttr() { CharacterBaseAttr baseAttr = FactoryManager.attrFactory.GetCharacterBaseAttr(mCharacterID); mPrefabName = baseAttr.prefabName; IAttrStrategy attrStrategy = new SelectCharacterAttrStrategy(); mSpawnPosition = attrStrategy.GetSpawnPosition(mCharacterRefreshPO); ICharacterAttr attr = new SelectCharacterAttr(attrStrategy, baseAttr); mCharacter.attr = attr; }
public override void AddCharacterAttr() { /* * //数值初始化 * string name = ""; * * int maxHP = 0; * * float moveSpeed = 0f; * * string iconSprite = ""; * * if (m_CharacterType == typeof(SoldierCaptain)) * { * name = "上尉士兵"; * maxHP = 100; * moveSpeed = 3f; * iconSprite = "CaptainIcon"; * m_PrefabName = "Soldier1"; * } * else if (m_CharacterType == typeof(SoldierSergeant)) * { * name = "中士士兵"; * maxHP = 90; * moveSpeed = 3f; * iconSprite = "SergeantIcon"; * m_PrefabName = "Soldier3"; * } * else if (m_CharacterType == typeof(SoldierRookie)) * { * name = "新兵士兵"; * maxHP = 80; * moveSpeed = 2.5f; * iconSprite = "RookieIcon"; * m_PrefabName = "Soldier2"; * } * else * { * Debug.LogError("找不到指定的士兵类型 T=" + m_CharacterType.ToString()); * } * ICharacterAttr attr = new SoldierAttr(new SoldierAttrStategy(), m_LV, name, maxHP, moveSpeed, iconSprite, m_PrefabName); * m_Character.Attr = attr; */ //享元模式优化成员属性 CharacterBaseAttr baseAttr = FactoryManager.AttrFactory.GetCharacterBaseAttr(m_CharacterType); m_PrefabName = baseAttr.PrefabName; ICharacterAttr attr = new SoldierAttr(new SoldierAttrStategy(), m_LV, baseAttr); m_Character.Attr = attr; }
public override void AddCharacterAttr() { CharacterBaseAttr baseAttr = FactoryManager.attrFactory.GetCharacterBaseAttr(mCharacterID); mPrefabName = baseAttr.prefabName; IAttrStrategy attrStrategy = new WolfAttrStrategy(); mSpawnPosition = attrStrategy.GetSpawnPosition(mCharacterRefreshPO); WolfAttr attr = new WolfAttr(attrStrategy, baseAttr); mCharacter.attr = attr; mCharacter.InitRefreshData((E_ActionType)mCharacterRefreshPO.ActionType, mCharacterRefreshPO.AppeareArea, mCharacterRefreshPO.FactorSpeed, mCharacterRefreshPO.DisappearTime, mCharacterRefreshPO.StayArea); }
//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; }
public override void AddCharacterAttr() { CharacterBaseAttr baseAttr = FactoryManager.attrFactory.GetCharacterBaseAttr(mCharacterID); mPrefabName = baseAttr.prefabName; mPrefabName = mPrefabName + Util.Random(0, 5); IAttrStrategy attrStrategy = new NpcAttrStrategy(); mSpawnPosition = attrStrategy.GetSpawnPosition(mCharacterRefreshPO); mSpawnLocalEuler = attrStrategy.GetEulerAngle(mCharacterRefreshPO); ICharacterAttr attr = new NpcAttr(attrStrategy, baseAttr); mCharacter.attr = attr; mCharacter.InitRefreshData((E_ActionType)mCharacterRefreshPO.ActionType, mCharacterRefreshPO.AppeareArea, mCharacterRefreshPO.FactorSpeed, mCharacterRefreshPO.DisappearTime); }
private bool OnRescue(int index) { Citizen citizen = ioo.characterSystem.CitizenIsWaittingForHelp(); if (citizen == null) { return(false); } CharacterBaseAttr baseAttr = FactoryManager.attrFactory.GetCharacterBaseAttr(mHelicopterID); ISpawnCommand command = new SpawnHelicopterCommand(baseAttr.id, null, citizen, index); command.Execute(); return(true); }
public override void AddCharacterAttr() { //string name = ""; //int maxHP = 0; //float moveSpeed = 0; //string iconSprite = ""; //string prefabName = ""; //if (mType == typeof(SoldierCaptain)) //{ // name = "上尉军官"; // maxHP = 100; // moveSpeed = 3; // iconSprite = "CaptainIcon"; // mPrefabName = "Soldier1"; //} //else if (mType == typeof(SoldierSergeant)) //{ // name = "中士士兵"; // maxHP = 90; // moveSpeed = 3; // iconSprite = "SergeantIcon"; // mPrefabName = "Soldier3"; //} //else if (mType == typeof(SoldierRookie)) //{ // name = "新手士兵"; // maxHP = 80; // moveSpeed = 2.5f; // iconSprite = "RookieIcon"; // mPrefabName = "Soldier2"; //} //else //{ // Debug.LogError("类型" + mType + "不属于ISoldier,无法创建战士"); //} //ICharacterAttr attr = new ICharacterAttr(new SoldierAtrrStrategy(), mLv, name, maxHP, moveSpeed, iconSprite, prefabName); CharacterBaseAttr baseAttr = FactoryManager.attrFactory.GetCharacterBaseAttr(mType); mPrefabName = baseAttr.prefabName; ICharacterAttr attr = new ICharacterAttr(new SoldierAtrrStrategy(), mLv, baseAttr); mCharacter.attr = attr; }
public override void AddCharacterAttr() { //string name = ""; //int maxHP = 0; //float moveSpeed = 0; //string iconSprite = ""; //if (mType == typeof(EnemyElf)) //{ // name = "小精灵"; // maxHP = 100; // moveSpeed = 3; // iconSprite = "ElfIcon"; // mPrefabName = "Enemy1"; //} //else if (mType == typeof(EnemyOgre)) //{ // name = "怪物"; // maxHP = 120; // moveSpeed = 4; // iconSprite = "OgreIcon"; // mPrefabName = "Enemy2"; //} //else if (mType == typeof(EnemyTroll)) //{ // name = "巨魔"; // maxHP = 200; // moveSpeed = 1f; // iconSprite = "TrollIcon"; // mPrefabName = "Enemy3"; //} //else //{ // Debug.LogError("类型" + mType + "不属于IEnemy,无法创建战士"); //} //ICharacterAttr attr = new ICharacterAttr(new SoldierAtrrStrategy(), mLv, name, maxHP, moveSpeed, iconSprite, mPrefabName); CharacterBaseAttr baseAttr = FactoryManager.attrFactory.GetCharacterBaseAttr(mType); mPrefabName = baseAttr.prefabName; ICharacterAttr attr = new ICharacterAttr(new EnemyAttrStrategy(), mLv, baseAttr); mCharacter.attr = attr; }
public BullDemonKingAttr(IAttrStrategy strategy, CharacterBaseAttr baseAttr) : base(strategy, baseAttr) { }
//public SoldierAttr(IAttrStrategy strategy, int lv, string name, int maxHP, float moveSpeed, string iconSprite, string prefabName) : base(strategy,lv, name, maxHP, moveSpeed, iconSprite, prefabName) //{ //} public SoldierAttr(IAttrStrategy strategy, int lv, CharacterBaseAttr baseAttr) : base(strategy, lv, baseAttr) { }
public EnemyAttr(IAttrStrategy _attrStrategy, CharacterBaseAttr _baseAttr, int _lv, float _critRate) : base(_attrStrategy, _baseAttr, _lv, _critRate) { }
public EnemyAttr(IAttrStrategy strategy, int lv, CharacterBaseAttr baseAttr) : base(strategy, lv, baseAttr) { }
/// <summary> /// 按照刷新表动态刷新场景活动单元 /// </summary> void RefreshCharacter() { while (true) { int refreshID = 100000 + ((int)mStageSystem.sceneID) * 10000 + mStageSystem.refreshIndex; CharacterRefreshPO characterRefreshPO = CharacterRefreshData.Instance.GetCharacterRefreshPO(refreshID); if (characterRefreshPO == null) { break; } if (characterRefreshPO.Stage != mLv) { break; } if (characterRefreshPO.AppeareTime > mStageTimer) { return; } CharacterBaseAttr baseAttr = FactoryManager.attrFactory.GetCharacterBaseAttr(characterRefreshPO.CharacterID); if (characterRefreshPO.Loop == 1) { LoopRefresh lr = new LoopRefresh(characterRefreshPO.CharacterID, baseAttr.name, baseAttr.characterType, characterRefreshPO); mLoopList.Add(lr); ++mStageSystem.refreshIndex; continue; } E_CharacterType characterType = baseAttr.characterType; switch (characterType) { case E_CharacterType.Player: ISpawnCommand command = new SpawnCharacterCommand(baseAttr.id, characterRefreshPO); mCommands.Add(command); break; case E_CharacterType.Map: command = new SpawnMapCommand(baseAttr.id, characterRefreshPO); mCommands.Add(command); break; case E_CharacterType.Citizen0: case E_CharacterType.Citizen1: case E_CharacterType.Citizen2: command = new SpawnCitizenCommand(baseAttr.id, characterRefreshPO); mCommands.Add(command); break; case E_CharacterType.Npc: for (int i = 0; i < characterRefreshPO.StepCount; ++i) { command = new SpawnNpcCommand(baseAttr.id, characterRefreshPO); mCommands.Add(command); } break; case E_CharacterType.SandBox: case E_CharacterType.Bucket: command = new SpawnPropCommand(baseAttr.id, characterRefreshPO, Vector3.zero); mCommands.Add(command); break; case E_CharacterType.BullDemonKing: command = new SpawnBullDemonKingCommand(baseAttr.id, characterRefreshPO); mCommands.Add(command); break; case E_CharacterType.AngerBear: command = new SpawnBearCommand(baseAttr.id, characterRefreshPO); mCommands.Add(command); break; case E_CharacterType.Wolf: command = new SpawnWolfCommand(baseAttr.id, characterRefreshPO); mCommands.Add(command); break; } ++mStageSystem.refreshIndex; } }
public HelicopterAttr(IAttrStrategy strategy, CharacterBaseAttr baseAttr) : base(strategy, baseAttr) { }
public HugeFireMonsterAttr(IAttrStrategy strategy, CharacterBaseAttr baseAttr) : base(strategy, baseAttr) { }
public NpcAttr(IAttrStrategy strategy, CharacterBaseAttr baseAttr) : base(strategy, baseAttr) { }