| | |
| | | |
| | | public partial class TeamBase |
| | | { |
| | | |
| | | // 区分一下阵营跟阵容 阵营为一个TeamBase列表 可能是多个玩家组合而成 |
| | | // 阵容为一个TeamBase 是玩家的一个队伍 |
| | | private int teamIndex = 0;//该阵营的第几个队伍 |
| | | |
| | | private uint playerId = 0; //该阵容的玩家id |
| | | |
| | | private int ShapeType; //本阵容阵型,0为默认阵型,可扩展不同的阵型,如boss特殊战斗阵型,或者其他不同站位的阵型 |
| | | |
| | | public bool IsPlayer |
| | | { |
| | | get |
| | | { |
| | | return playerId == 0; |
| | | } |
| | | } |
| | | |
| | | public TeamHero[] teamHeros = new TeamHero[TeamConst.MaxTeamSlotCount]; |
| | | |
| | | public TeamBase() |
| | | { |
| | | |
| | | } |
| | | |
| | | public TeamBase(HB424_tagSCTurnFightInit.tagSCTurnFightLineup lineUp) |
| | | { |
| | | teamIndex = lineUp.Num; |
| | | playerId = lineUp.OwnerID; |
| | | ShapeType = lineUp.ShapeType; |
| | | |
| | | for (int i = 0; i < lineUp.ObjCnt; i++) |
| | | { |
| | | if (i < teamHeros.Length) |
| | | { |
| | | TeamHero hero = new TeamHero(lineUp.ObjList[i], this); |
| | | AddTeamHero(hero); |
| | | } |
| | | } |
| | | |
| | | Update(); |
| | | |
| | | |
| | | } |
| | | |
| | | protected void Update() |
| | | { |
| | | // 检查国籍 |
| | | |
| | | // 检查羁绊 |
| | | |
| | | // 检查阵型 |
| | | |
| | | // 更新队伍英雄属性 |
| | | foreach (var teamHero in teamHeros) |
| | | { |
| | | teamHero.Update(); |
| | | } |
| | | |
| | | // 更新队伍属性 |
| | | // UpdateProperties(); |
| | | |
| | | // CalculatePower(); |
| | | } |
| | | |
| | | public void SetShapeType(int shapeType) |
| | | { |
| | | ShapeType = shapeType; |
| | | } |
| | | |
| | | public int GetTeamHeroCount() |
| | | { |
| | |
| | | return true; |
| | | } |
| | | |
| | | public void AddTeamHeros(List<HeroInfo> heroInfos) |
| | | public void AddHeroInfos(List<HeroInfo> heroInfos) |
| | | { |
| | | for (int i = 0; i < heroInfos.Count; i++) |
| | | { |
| | | AddTeamHero(heroInfos[i]); |
| | | AddHeroInfo(heroInfos[i]); |
| | | } |
| | | |
| | | UpdateProperties(); |
| | | } |
| | | |
| | | public bool AddTeamHero(HeroInfo heroInfo) |
| | | |
| | | public bool AddHeroInfo(HeroInfo heroInfo) |
| | | { |
| | | if (heroInfo == null) |
| | | { |
| | |
| | | teamHeros[i].heroInfo = heroInfo; |
| | | teamHeros[i].heroIndex = i; |
| | | UpdateProperties(); |
| | | return true; |
| | | return true; |
| | | } |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | |
| | | public void AddTeamHero(TeamHero teamHero) |
| | | { |
| | | if (null == teamHero) |
| | | { |
| | | return; |
| | | } |
| | | |
| | | teamHeros[teamHero.heroIndex] = teamHero; |
| | | } |
| | | |
| | | |
| | | public bool RemoveTeamHero(int index) |
| | | { |
| | |
| | | return GetTeamHeroCount() == 0; |
| | | } |
| | | |
| | | public void InitByLevelId(int levelId) |
| | | { |
| | | |
| | | } |
| | | |
| | | #if UNITY_EDITOR |
| | | public void FillWithFakeData() |
| | |
| | | { |
| | | TeamHero hero = new TeamHero(); |
| | | hero.curHp = 100; |
| | | hero.attack = UnityEngine.Random.Range(300, 500); |
| | | hero.defense = UnityEngine.Random.Range(80, 100); |
| | | hero.heroInfo = new HeroInfo(); |
| | | hero.teamBase = this; |
| | | hero.heroIndex = i; |