public static bool AskForMapGridDeep(int SceneID, MapStations m, int StaionsDeep, LifeMCamp Camp, DIR dir, SEARCHAGT ST, ref Int2 Pos, ref int Deep) { if (ST == SEARCHAGT.SAGTY_HD) { return(AskForMapGridDeepHD(SceneID, m, StaionsDeep, Camp, dir, ref Pos, ref Deep)); } else if (ST == SEARCHAGT.SAGTY_THDA) { return(AskForMapGridDeepAttack(SceneID, m, StaionsDeep, Camp, dir, ref Pos, ref Deep)); } else if (ST == SEARCHAGT.SAGTY_POLL) { return(AskForMapGridDeepPoll(SceneID, m, StaionsDeep, Camp, dir, ref Pos, ref Deep)); } else { return(false); } }
public void CheckDead() { LifeMCamp camp = m_Core.m_Camp == LifeMCamp.ATTACK? LifeMCamp.DEFENSE : LifeMCamp.ATTACK; List <Life> lb = new List <Life>(); int count = 0; if (m_EnemyType == PetEnemyType.Build) { CM.SearchLifeMListInBoat(ref lb, LifeMType.BUILD, camp); foreach (Building b in lb) { if (b.m_Attr.IsDamage && !b.m_Attr.IsResource) { count++; } } } else if (m_EnemyType == PetEnemyType.SOLDIER) { CM.SearchLifeMListInBoat(ref lb, LifeMType.SOLDIER, camp); foreach (Role b in lb) { count++; } } if (count <= 0) { Dead(); } }
private static bool AskForMapGridDeep(int SceneID, MapGrid m, int StaionsDeep, LifeMCamp Camp, ref Int2 Pos, ref int Deep, ref int ret, ref MapGrid n) { ret = 0; if (m == null) { ret = 2; return(false); } int d = m.AskForStaionsDeep(StaionsDeep, Camp, ref ret); if (d != -1) { Deep = d; Pos = m.GetStationsPos(); return(true); } if (m.PropStations == StationsProp.ATTACK && m.GetGridCamp(Camp) && n == null) { n = m; } return(false); }
/// <summary> /// 获取角色列表 /// </summary> public void GetCampRoleList(LifeMCamp Camp, ref List <int> lSameCampRole, ref List <int> lUnSameCampRole) { if (lSameCampRole == null) { lSameCampRole = new List <int>(); } lSameCampRole.Clear(); if (lUnSameCampRole == null) { lUnSameCampRole = new List <int>(); } lUnSameCampRole.Clear(); for (int i = 0; i < RoleList.Count; i++) { if (RoleList[i].m_Camp == Camp) { lSameCampRole.Add(RoleList[i].m_SceneID); } else { lUnSameCampRole.Add(RoleList[i].m_SceneID); } } }
public override int AskForStaionsDeep(int StaionsDeep, LifeMCamp Camp, ref int ret) { ret = 0; if (PropStations != StationsProp.ATTACK) { return(-1); } if (m_HoldRole.AntiCamp(Camp) == true || m_TempRole.AntiCamp(Camp) == true) { ret = 2; return(-1); } if (m_Channel.GetIdleChanel(ref StaionsDeep)) { return(StaionsDeep); } else { ret = 1; return(-1); } }
static public void GetWetTarget(ref List <Life> targetlist, SkillInfo skill, Life own) { float radius = ConfigM.GetWetBodyRange() * 0.01f; List <Life> lr = new List <Life>(); LifeMCamp camp = GetSkillCamp(skill, own); CM.SearchLifeMListInBoat(ref lr, LifeMType.SOLDIER, camp); for (int i = 0; i < targetlist.Count; i++) { Life l = targetlist[i]; foreach (Role r in lr) { if (NdUtil.IsSameMapLayer(l.MapPos, r.MapPos)) { if (r.m_thisT.localPosition.x >= (l.m_thisT.localPosition.x - radius) && r.m_thisT.localPosition.x <= (l.m_thisT.localPosition.x + radius)) { if (r.m_Attr.IsWetBody) { if (!targetlist.Contains(r)) { targetlist.Add(r); } } } } } } }
/// <summary> /// 进攻防守阵营转是否玩家 /// </summary> public static bool GetCamp2Player(LifeMCamp Camp) { if (BattleEnvironmentM.GetBattleEnvironmentMode() == BattleEnvironmentMode.CombatPVE && StageDC.GetPveMode() == PVEMode.Defense) { if (Camp == LifeMCamp.ATTACK) { return(false); } else { return(true); } } else { if (Camp == LifeMCamp.ATTACK) { return(true); } else { return(false); } } }
public List <Life> GetBuildSkillTarget() { List <Life> RoleList = new List <Life>(); LifeMCamp camp = GetSkillCamp(m_skill, m_Parent); SoldierSkill skill = m_skill as SoldierSkill; if ((skill.m_damagetargettype & (int)TargetType.Soldier) == (int)TargetType.Soldier) { List <Life> lr = new List <Life>(); CM.SearchLifeMListInBoat(ref lr, LifeMType.SOLDIER, camp); foreach (Role r in lr) { if (CheckCanAttack(r.CurrentAction) && CheckRangeAttackTarget(r, m_Parent.GetMapGrid(), skill.m_sort, skill.m_range, WalkDir.WALKSTOP)) { RoleList.Add(r); } } } if ((skill.m_damagetargettype & (int)TargetType.Pet) == (int)TargetType.Pet) { List <Life> lp = new List <Life>(); CM.SearchLifeMListInBoat(ref lp, LifeMType.SUMMONPET, camp); foreach (Role r in lp) { if (CheckCanAttack(r.CurrentAction) && CheckRangeAttackTarget(r, m_Parent.GetMapGrid(), skill.m_sort, skill.m_range, WalkDir.WALKSTOP)) { RoleList.Add(r); } } } /*int distant = skill.m_distance / MapGrid.m_Pixel; * if ((skill.m_targettype & (int)TargetType.Soldier) == (int)TargetType.Soldier) * { * List<Life> l = new List<Life>(); * ///需要排除隐形 。。。。。。。。。。。。。。。。。。 * CM.SearchLifeMListInBoat(ref l, LifeMType.SOLDIER, camp); * foreach (Role r in l) * { * * * if ( CheckAttackTarget(r, skill.m_sort, distant, skill.m_condition != (int)SkillCondition.SameLayer) ) * RoleList.Add(r); * } * } * if ((skill.m_targettype & (int)TargetType.Pet) == (int)TargetType.Pet) * { * List<Life> lp = new List<Life>(); * CM.SearchLifeMListInBoat(ref lp, LifeMType.SUMMONPET, camp); * foreach (Life p in lp) * { * * if (CheckAttackTarget(p, skill.m_sort, distant, skill.m_condition != (int)SkillCondition.SameLayer) ) * RoleList.Add(p); * } * } * CheckMultiple(ref RoleList, m_skill);*/ return(RoleList); }
public void Copy(LifeMCore s) { this.m_DataID = s.m_DataID; this.m_type = s.m_type; this.m_Camp = s.m_Camp; this.m_MoveState = s.m_MoveState; this.m_IsPlayer = s.m_IsPlayer; }
public LifeMCore(int Data, bool IsPlayer, LifeMType Type, LifeMCamp Camp, MoveState State) { this.m_DataID = Data; this.m_IsPlayer = IsPlayer; this.m_type = Type; this.m_Camp = Camp; this.m_MoveState = State; }
/// <summary> /// 搜索格子最近的己方目标 /// </summary> /// <param name="g"></param> Life SearchSelfNearestTarget(MapGrid g, LifeMCamp camp, float threshold) { List <Life> listSelfLife = new List <Life>(); CM.SearchLifeMListByGrid(ref listSelfLife, null, LifeMType.SOLDIER, camp, MapSearchStlye.SameLayer, g, 0); Life result = listSelfLife.Find(life => (Mathf.Abs(life.GetLifeProp().transform.position.x - g.WorldPos.x) <= threshold)); return(result); }
public int m_CaptainID; //船长ID public CaptainSkillInfo(int CaptainID, LifeMCamp Camp, int mana) { m_CaptainID = CaptainID; CaptionInfo God = BlackScienceDC.GetCaption(CaptainID); m_Skill.SetSkill(God.GetGodSkillInfo()); m_Skill.Camp = Camp; m_Mana = mana; }
/// <summary> /// 划分前后阵营,前阵营优先在已进入列表中寻找 /// </summary> public void CalcMainCamp(ref List <RolePower> lOld, ref List <RolePower> lNew) { lOld.Sort((x, y) => { return(RolePower.Compare(x, y)); }); lNew.Sort((x, y) => { return(RolePower.Compare(x, y)); }); LifeMCamp MainCamp = LifeMCamp.NONE; if (lOld != null && lOld.Count > 0) { MainCamp = lOld[0].m_Camp; } else if (lNew != null && lNew.Count > 0) { MainCamp = lNew[0].m_Camp; } // m_lFrontCamp.Clear(); m_lBackCamp.Clear(); if (lOld != null && lOld.Count > 0) { foreach (RolePower p in lOld) { if (p.m_Camp == MainCamp) { m_lFrontCamp.Add(p); } else { m_lBackCamp.Add(p); } } } if (lNew != null && lNew.Count > 0) { foreach (RolePower p in lNew) { if (p.m_Camp == MainCamp) { m_lFrontCamp.Add(p); } else { m_lBackCamp.Add(p); } } } lOld.Clear(); lNew.Clear(); }
/// <summary> /// 加载模型 /// </summary> public override void SetGameRole(Life life, MoveState State, LifeMCamp Camp, bool IsPlayer) { if (life == null) { return; } m_SkinOwner = life; m_State = State; m_IsPlayer = IsPlayer; m_Camp = Camp; }
/// <summary> /// 通道排序 /// </summary> public void SortChannel() { ResetChannel(); m_lFrontCamp.Sort((x, y) => { return(RolePower.Compare(x, y)); }); m_lBackCamp.Sort((x, y) => { return(RolePower.Compare(x, y)); }); bool HaveFront = false; LifeMCamp TopFrontCamp = LifeMCamp.NONE; //置顶通道 if (m_TLPower.Count > 0) { int sceneID = m_TLPower[0].SceneID; HaveFront = true; TopFrontCamp = m_TLPower[0].m_Camp; RoleSeatDeep(sceneID, 0); } //前置阵营通道 if (m_lFrontCamp.Count > 0) { int start = 0; if (HaveFront == true && TopFrontCamp == m_lFrontCamp[0].m_Camp) { start = 1; } for (int i = 0; i < m_lFrontCamp.Count; i++) { int sceneID = m_lFrontCamp[i].SceneID; RoleSeatDeep(sceneID, i + start); } } //后置阵营 if (m_lBackCamp.Count > 0) { int start = 0; if (HaveFront == true && TopFrontCamp == m_lBackCamp[0].m_Camp) { start = 1; } for (int i = 0; i < m_lBackCamp.Count; i++) { HaveFront = true; int sceneID = m_lBackCamp[i].SceneID; RoleSeatDeep(sceneID, i + start); } } }
public float m_Speed; // 行走速度 public StationsInfo(StationsInfo s) { this.m_StaionsDeep = s.m_StaionsDeep; this.m_Camp = s.m_Camp; this.m_dir = s.m_dir; this.m_InPutTime = s.m_InPutTime; this.m_GridSpace = s.m_GridSpace; this.m_IsHide = s.m_IsHide; this.m_Passageway = s.m_Passageway; this.m_Shape = s.m_Shape; this.m_Speed = s.m_Speed; }
/// <summary> /// 加载模型 /// </summary> public override void SetGameRole(Life life, MoveState State, LifeMCamp Camp, bool IsPlayer) { base.SetGameRole(life, State, Camp, IsPlayer); /*iGameRole = igameRole; * m_tRoot = iGameRole.GetGameRoleRootTransfrom(); * m_tbody = iGameRole.GetBodyObj().transform; * ProPerty = iGameRole.GetRolePropertyM();*/ m_Duration = 0; m_TimeCount = 0; }
public void DoSkill(int times) { if (m_skill == null) { return; } SoldierSkill skill = m_skill as SoldierSkill; List <Life> targetlist = new List <Life>(); LifeMCamp camp = m_parent.m_Core.m_Camp == LifeMCamp.ATTACK?LifeMCamp.DEFENSE : LifeMCamp.ATTACK; targetlist = GetRangeAttackList(MapGrid.GetMG(m_parent.m_Pos), skill, camp, null); if (skill.m_actiontype == 0) { StatusSelfBuff(m_parent, m_skill); for (int i = 0; i < targetlist.Count; i++) { if (!targetlist[i].InBoat) { continue; } SkillReleaseInfo info = Life.CalcDamage(m_parent, targetlist[i], null, m_skill); if (skill.m_attckmodeid > 0) { float power = skill.GetAttackPower(times); info.m_Damage = (int)(info.m_Damage * power); } Transform attackT = m_parent.m_thisT; targetlist[i].ApplyDamage(info, attackT); } //Debug.Log(str); } else if (skill.m_actiontype == 1) { StatusSelfBuff(m_parent, m_skill); for (int i = 0; i < targetlist.Count; i++) { if (!targetlist[i].InBoat) { continue; } SkillReleaseInfo info = Life.CalcDamage(m_parent, targetlist[i], null, m_skill); Debug.Log("doskill " + m_skill.m_name + "," + info.m_Damage); if (skill.m_attckmodeid > 0) { float power = skill.GetAttackPower(times); info.m_Damage = (int)(info.m_Damage * power); } Transform attackT = m_parent.m_thisT; targetlist[i].ApplyDamage(info, attackT); } //Debug.Log(str); } }
/// <summary> /// 添加船长技能 ,Ispalyer : true 玩家自己 flase 非玩家 /// </summary> public static void AddGodSkill(bool IsPlayer, int CaptainID, int mana) { LifeMCamp Camp = GetPlayer2Camp(IsPlayer); if (m_CaptainSkill == null) { m_CaptainSkill = new Dictionary <bool, CaptainSkillInfo>(); } if (m_CaptainSkill.ContainsKey(IsPlayer) == true) { m_CaptainSkill.Remove(IsPlayer); } m_CaptainSkill.Add(IsPlayer, new CaptainSkillInfo(CaptainID, Camp, mana)); }
public static bool AskForMapGridDeepPoll(int SceneID, MapStations m, int StaionsDeep, LifeMCamp Camp, DIR dir, ref Int2 Pos, ref int Deep) { MapGrid l = null; MapGrid r = null; MapGrid c = null; MapGrid n = null; //最近的同一阵营格子 DIR Dir = DIR.LEFT; int ret = 0; if (GetNAS(ref l, ref r, ref c, ref Dir, m, dir) == false) { return(false); } if (AskForMapGridDeep(SceneID, c, StaionsDeep, Camp, ref Pos, ref Deep, ref ret, ref n) == true) { return(true); } int total = 0; while (total < 8) { GetNASPoll(ref l, ref r, ref Dir, ref c); if (AskForMapGridDeep(SceneID, c, StaionsDeep, Camp, ref Pos, ref Deep, ref ret, ref n) == true) { return(true); } total++; } Deep = 2; //使用最里面的通道 if (n != null) { Pos = n.GetStationsPos(); } else { Debug.Log("获取不到附近格子" + m.GetStationsPos()); Pos = m.GetStationsPos(); } return(true); }
static public LifeMCamp GetSkillCamp(SkillInfo skill, Life owner) { LifeMCamp camp = owner.m_Core.m_Camp == LifeMCamp.ATTACK ? LifeMCamp.DEFENSE : LifeMCamp.ATTACK; if (skill.m_target == (int)SkillTarget.SomeOneFriendly || skill.m_target == (int)SkillTarget.Self || skill.m_target == (int)SkillTarget.FriendlyGround || skill.m_target == (int)SkillTarget.FriendlyTeam) { camp = owner.m_Core.m_Camp; } if (owner.m_Attr.Charmed && skill.m_target != 1) { camp = camp == LifeMCamp.ATTACK ? LifeMCamp.DEFENSE : LifeMCamp.ATTACK; } return(camp); }
public void DoQianYaoStatus(Life target, LifeMCamp camp) { if (target != null) { //debuff 给对方增加状态 if (target.m_Core.m_Camp == camp) { StatusReleaseBuff(target); } else { StatusReleaseDeBuff(target); } } }
//获取当前格子阵营 public bool GetGridCamp(LifeMCamp Camp) { LifeMCamp c = LifeMCamp.NONE; DIR dir = DIR.NONE; if (m_HoldRole.AntiCamp(Camp) == true) { return(false); } // if (m_TempRole.AntiCamp(Camp) == true) { return(false); } return(true); }
/// <summary> /// 是否包含对立阵营的炮弹兵, 有true 否 flase /// </summary> public bool AntiCamp(LifeMCamp Camp) { for (int i = 0; i < RoleList.Count; i++) { StationsInfo Info = RoleList[i]; if (Info == null || Info.IsValidStations() == true) { continue; } if (Info.m_Camp != Camp) { return(true); } } return(false); }
public void Teleport(MapGrid g, bool ischange = true) { #if UNITY_EDITOR_LOG FileLog.write(m_Owner.SceneID, "Teleport " + g.GridPos + "," + m_Owner.m_thisT.localPosition); #endif LifeMCamp Camp = (m_Owner.m_Core.m_Camp == LifeMCamp.ATTACK) ? LifeMCamp.DEFENSE : LifeMCamp.ATTACK; List <Life> RoleList = new List <Life>(); CM.SearchLifeMListInBoat(ref RoleList, LifeMType.SOLDIER | LifeMType.SUMMONPET, Camp); AIPathConditions.AIPathEvent(new AIEventData(AIEvent.EVENT_TM), RoleList); AIPathConditions.AIPathEvent(new AIEventData(AIEvent.EVENT_SELFSP), m_Owner); if (ischange) { m_Owner.ChangeTarget(ChangeTargetReason.Teleport, null); } run.ClearPath(); run.Teleport(g); }
public override void NDUpdate(float deltaTime) { if (CheckCombatIng()) { if (m_timecount > m_info.m_time) { return; } m_timecount += deltaTime; if (m_timecount > m_info.m_time) { GameObject.Destroy(m_thisT.gameObject); } else { if (m_timecount > m_cout * m_info.m_timeinterval) { m_cout++; List <Life> lr = new List <Life>(); LifeMCamp camp = m_Parent.m_Core.m_Camp == LifeMCamp.ATTACK ? LifeMCamp.DEFENSE : LifeMCamp.ATTACK; CM.SearchLifeMListInBoat(ref lr, LifeMType.SOLDIER, camp); for (int i = 0; i < lr.Count; i++) { if (NdUtil.IsSameMapLayer(lr[i].GetMapPos(), m_Pos)) { if (lr[i].m_thisT.localPosition.x > m_MapGrid.pos.x - m_info.m_range && lr[i].m_thisT.localPosition.x < m_MapGrid.pos.x + m_info.m_range) { SkillReleaseInfo sInfo = new SkillReleaseInfo(); sInfo.m_InterruptSkill = false; sInfo.m_MakeStatus = new List <StatusType> (); sInfo.m_bImmunity = false; sInfo.m_Damage = m_info.m_ReduceAttr.GetAttr(EffectType.RecoHp); int fire = m_info.m_ReduceAttr.GetAttr(EffectType.FireAttack); if (fire > 0) { sInfo.m_Damage = Skill.CalcAttributableSkillDamage(AttributeType.Fire, lr[i].m_Attr, sInfo.m_Damage); } sInfo.Result = AttackResult.Normal; lr[i].ApplyDamage(sInfo, null); } } } } } } }
public static SoldierInfo GetSoldierInfo(LifeMCamp Camp, int DataID) { if (Camp == LifeMCamp.ATTACK) { if (m_AttackList.ContainsKey(DataID) == true) { return(m_AttackList[DataID].m_Soldier); } } else { if (m_DefenseList.ContainsKey(DataID) == true) { return(m_DefenseList[DataID]); } } return(null); }
/// <summary> /// 获取掉落物品奖励 /// </summary> public static List <int> GetRewardItem(LifeMCamp Camp, int DataID) { if (Camp == LifeMCamp.ATTACK) { if (m_AttackList.ContainsKey(DataID) == true) { return(m_AttackList[DataID].m_Soldier.m_RewardItem); } } else { if (m_DefenseList.ContainsKey(DataID) == true) { return(m_DefenseList[DataID].m_RewardItem); } } return(new List <int>()); }
public List <Life> GetRangeAttackList(MapGrid g, SkillInfo skill, LifeMCamp camp, Life targetAttack) { int Sort = (skill as SoldierSkill).m_sort; float radus = (skill as SoldierSkill).m_range / MapGrid.m_Pixel; List <Life> l = new List <Life>(); List <Life> lr = new List <Life>(); CM.SearchLifeMListInBoat(ref lr, LifeMType.SOLDIER, camp); foreach (Role r in lr) { if (CheckRangeAttackTarget(r, g, Sort, radus)) { l.Add(r); } } return(l); }
/// <summary> /// 满足Core条件判断 /// </summary> /// <param name="HaveList">不为空,则在这个列表中进行搜索,为空在所有CM管理的列表中进行搜索</param> /// <param name="Camp">按指定的阵营</param> /// <returns>true 满足条件,false 不满足条件</returns> private static bool CheckCoreConditions(LifeMCore Core, LifeMCamp Camp) { if (Core == null) { return(false); } if ((Camp & Core.m_Camp) == 0) { return(false); } else { return(true); } }