/// <summary> /// 检测是否有可触发陷阱,判断标准,为陷阱,且不处于cd /// </summary> /// <returns>false,没有,true 有</returns> public bool CheckTrap() { if (Road == null) { return(false); } List <int> l = new List <int>(); Road.GetBuildList(ref l); foreach (int SceneID in l) { Life life = CM.GetLifeM(SceneID, LifeMType.BUILD); if (life == null) { continue; } if (life is Building) { Building build = life as Building; if (!build.IsInCDStatus()) { return(true); } } } return(false); }
protected NDAttribute GetBuildRoomAttr(Life parent, int layer, int unit) { Int2 Pos = new Int2(unit, layer); if (parent is LeftFloorWall) { Pos.Unit += 3; } else if (parent is rightFloorWall) { Pos.Unit -= 3; } MapGrid m = MapGrid.GetMG(Pos); if (m != null) { int BuildRoomSceneID = -1; if (m.GetBuildRoom(ref BuildRoomSceneID) == true) { Life buildRoom = CM.GetLifeM(BuildRoomSceneID, LifeMType.BUILD); if (buildRoom != null) { return(buildRoom.m_Attr); } } } return(null); }
/// <summary> /// 初始化技能数据,从数据中心获取所有技能数据 /// </summary> public override bool Init(int SceneID, LifeMCore Core) { this.m_SceneID = SceneID; m_parent = CM.GetLifeM(m_SceneID, LifeMType.PET) as Pet; PetInfo Info = CmCarbon.GetPetInfo(Core); m_skill = Info.m_skillinfo1; return(true); }
public GridActionCmdActiveSkill(DoQianyaoFun qianyaofun, DoAttackFun fun, int sceneID, int AttackSceneId, WalkDir AttackDir, int deep, int skillid, float blackscreentime) : base(qianyaofun, fun, AttackSceneId, AttackDir, deep, skillid) { m_iSceneID = sceneID; m_bRunOnce = true; m_LifePrent = CM.GetLifeM(m_iSceneID, LifeMType.SOLDIER); m_lifeMCore = m_LifePrent.m_Core; m_blackscreentime = blackscreentime; s_activeskill.Add(this); //Debug.Log("aaa:start="+ Time.time); }
public override void Init(int SceneID, int ResalseSceneID, int SkillID, SkillStatusInfo Info) { m_OverData = StatusOverAction.CD | StatusOverAction.Die; m_AddRole = AddRule.Replace; m_type = StatusType.TearOfMermaid; m_SkillImmune = ImmuneSkill.Normal; m_InterruptSkill = false; m_SelfInterruptSkill = false; m_AntiInterruptStatus = AntiInterruptStatus.Normal; base.Init(SceneID, ResalseSceneID, SkillID, Info); mOwner = CM.GetLifeM(SceneID, LifeMType.SOLDIER) as Role; mStatusActive = false; }
public override void RemoveStatus(float duration) { base.RemoveStatus(duration); mcd -= duration; if (mcd <= 0) { mStatusActive = true; SoldierSkill sourceSkill = new SoldierSkill(); SkillM.GetSkillInfo(m_StatusInfo.exSkill1, m_StatusInfo.exSkillLevel1, ref sourceSkill); mcd = sourceSkill.m_cd * 0.001f; Role attacker = CM.GetLifeM(m_StatusInfo.Releasescentid, LifeMType.SOLDIER) as Role; RoleSkill.GlobalUseSkill(attacker, mOwner, sourceSkill, Vector3.zero); } }
public override bool Init(int SceneID, LifeMCore Core) { m_SceneID = SceneID; m_Parent = CM.GetLifeM(m_SceneID, LifeMType.BUILD); // by zhulin 屏蔽 /*BuildInfo Info = CmCarbon.GetBuildInfo(Core.m_DataID); * if(Info == null || Info.m_Skill == null) * return false; * m_skill = Info.m_Skill; * * m_CDDuration = m_skill.m_cd*0.001f;*/ m_CdTime = 0; return(true); }
/// <summary> /// cd技能攻击,第一次攻击处于等待状态, /// </summary> public override void Update(float deltaTime) { if (CM.GetLifeM(m_SceneID, LifeMType.BUILD) == null) { return; } m_CdTime -= deltaTime; if (m_CdTime <= 0) { if (SkillTrrigerHandler()) { ReSetCDTime(); } } }
public void AddBuildRoom(Int2 Pos) { MapGrid m = MapGrid.GetMG(Pos); if (m != null) { int BuildRoomSceneID = -1; if (m.GetBuildRoom(ref BuildRoomSceneID) == true) { Life buildRoom = CM.GetLifeM(BuildRoomSceneID, LifeMType.BUILD); if (buildRoom != null) { m_rooms.Add(buildRoom as Building); (buildRoom as Building).AddFloor(this); } } } }
public override void InterruptStatus(LifeAction Action) { if (mStatusActive) { return; } base.InterruptStatus(Action); if (Action == LifeAction.Die) { mStatusActive = true; SoldierSkill sourceSkill = new SoldierSkill(); SkillM.GetSkillInfo(m_StatusInfo.exSkill1, m_StatusInfo.exSkillLevel1, ref sourceSkill); Role attacker = CM.GetLifeM(m_StatusInfo.Releasescentid, LifeMType.SOLDIER) as Role; RoleSkill.GlobalUseSkill(attacker, mOwner, sourceSkill, Vector3.zero); } }
private void GetRole() { if (m_currentRAW == null) { int SceneID = CM.DataID2SceneIDInSoldier(SoldierDataID); Life life = CM.GetLifeM(SceneID, LifeMType.SOLDIER); if (life == null) { return; } if (life is Role) { m_currentRAW = life as Role; } } }
public override void RemoveStatus(float duration) { if (mStatusActive) { return; } base.RemoveStatus(duration); if (IsStatusOver()) { mStatusActive = true; SoldierSkill sourceSkill = new SoldierSkill(); SkillM.GetSkillInfo(m_StatusInfo.exSkill2, m_StatusInfo.exSkillLevel2, ref sourceSkill); Role attacker = CM.GetLifeM(m_StatusInfo.Releasescentid, LifeMType.SOLDIER) as Role; RoleSkill.GlobalUseSkill(attacker, mOwner, sourceSkill, Vector3.zero); } }
public IggWall GetWall() { if (m_lWall == null || m_lWall.Count == 0) { return(null); } foreach (int key in m_lWall) { Life m = CM.GetLifeM(key, LifeMType.WALL); if (m != null && m is IggWall) { return(m as IggWall); } } return(null); }
public bool CalcPos(int i) { if (i < 0 || i >= m_mgs.Count) { return(false); } MapGrid gto = m_mgs[i]; if (gto != null) { Role w = m_LifePrent as Role; List <int> role = new List <int>(); gto.GetRoleList(ref role); if (role.Count > 0) { foreach (int id in role) { Life l = CM.GetLifeM(id, LifeMType.SOLDIER); if (l is Role) { Role ww = l as Role; if (ww.CurrentAction is GridActionCmdHitByBuild1504) { continue; } else { w.RoleWalk.Teleport(gto); m_des = gto.pos; return(true); } } } } else { w.RoleWalk.Teleport(gto); m_des = gto.pos; return(true); } } m_LifePrent.InBoat = false; return(false); }
public void HasRole(ref List <string> AttackList, ref List <string> DefenseList) { List <int> Hold = new List <int>(); List <int> Temp = new List <int>(); GetRoleList(ref Hold, ref Temp); if (Hold.Count + Temp.Count <= 0) { return; } foreach (int key in Hold) { Life life = CM.GetLifeM(key, LifeMType.SOLDIER); if (life == null || life.m_Core == null) { continue; } if (life.m_Core.m_Camp == LifeMCamp.ATTACK) { AttackList.Add(/*"正式:" + */ life.m_Attr.AttrName + ":" + (life as Role).RankDeep); } else { DefenseList.Add(/*"正式:" + */ life.m_Attr.AttrName + ":" + (life as Role).RankDeep); } } foreach (int key in Temp) { Life life = CM.GetLifeM(key, LifeMType.SOLDIER); if (life == null || life.m_Core == null) { continue; } if (life.m_Core.m_Camp == LifeMCamp.ATTACK) { AttackList.Add(/*"临时" + */ life.m_Attr.AttrName + ":" + (life as Role).RankDeep); } else { DefenseList.Add(/*"临时" + */ life.m_Attr.AttrName + ":" + (life as Role).RankDeep); } } }
public void SelectRole(int sceneid) { CombatWnd cw = WndManager.FindDialog <CombatWnd>(); if (cw != null) { cw.Show9001(false); } Life target = CM.GetLifeM(sceneid, LifeMType.SOLDIER); ReleaseSkill(target.GetMapGrid(), target.GetMapGrid().WorldPos, target); CombatWnd wnd = WndManager.FindDialog <CombatWnd>(); if (wnd) { wnd.ShowSkill9001Effect(sceneid); } }
// Use this for initialization void Start() { if (m_type != roombgtype.none) { Int2 Pos = m_pos; MapGrid m = MapGrid.GetMG(Pos); if (m != null) { int BuildRoomSceneID = -1; if (m.GetBuildRoom(ref BuildRoomSceneID) == true) { Life buildRoom = CM.GetLifeM(BuildRoomSceneID, LifeMType.BUILD); if (buildRoom != null) { //m_rooms.Add(buildRoom as BuildingRoom); (buildRoom as Building).AddBg(this); //buildRoom.ad } } } } }
public void Init(Int2 s, Int2 e) { start = s; end = e; for (int i = start.Unit; i <= end.Unit; i++) { MapGrid m = MapGrid.GetMG(start.Layer, i * MapGrid.m_UnitRoomGridNum + 3); if (m != null) { int BuildRoomSceneID = -1; if (m.GetBuildRoom(ref BuildRoomSceneID) == true) { Life buildRoom = CM.GetLifeM(BuildRoomSceneID, LifeMType.BUILD); if (buildRoom != null) { m_rooms.Add(buildRoom as Building); (buildRoom as Building).AddAccessories(this); } } } } }
void CreateHole() { if (Size <= 0) { return; } for (int i = 0; i <= Size; i++) { int WallID = -1; if (i == 0) { MapGrid.CreateLeftShareHole(new Int2(StartUnit + i, Layer), ref WallID); } else if (i == Size) { MapGrid.CreateRightShareHole(new Int2(StartUnit + i, Layer), ref WallID); } else { MapGrid.CreateHole(new Int2(StartUnit + i, Layer), ref WallID); } if (WallID != -1) { Life m = CM.GetLifeM(WallID, LifeMType.WALL); if (m is IggWall) { (m as IggWall).SetWallDead(); } } } }
/// <summary> /// 初始化技能数据,从数据中心获取所有技能数据 /// </summary> public override bool Init(int SceneID, LifeMCore Core) { this.m_SceneID = SceneID; m_SkillOwner = CM.GetLifeM(m_SceneID, LifeMType.SUMMONPET) as SummonPet; SummonpetInfo Info = SummonM.GetSummonPetInfo(Core.m_DataID); if (Info == null) { return(false); } //SoldierSkillInfo Info = info.m_Skillinfo; m_attack1 = "0"; m_attack2 = "0"; for (int i = 0; i <= 7; i++) { if (i < Info.m_Skillinfo.Count) { if (Info.m_Skillinfo[i].m_attacktype != (int)AttackType.PassiveCondition && Info.m_Skillinfo[i].m_condition != 0 && Info.m_Skillinfo[i].m_enable == true) { m_ConditionSkill.Add(Info.m_Skillinfo[i]); m_ConditionSkillTimeCount.Add(0f); } m_AllSkill.Add(Info.m_Skillinfo[i]); Info.m_Skillinfo[i].m_LifeTarget = null; Info.m_Skillinfo[i].m_TargetPos = null; } else { m_AllSkill.Add(new SoldierSkill()); } } GetNextSkill(); m_CdTime = m_CDDuration; m_CDDuration = m_AllSkill[0].m_cd; m_Release = false; return(true); }
/// <summary> /// 获取属性数据 /// </summary> protected int GetAttrData(List <int> lAttrData, EffectType Type) { int value = 0; if (lAttrData == null || lAttrData.Count == 0) { return(value); } int type = (int)Type; for (int i = 0; i < lAttrData.Count - 1; i += 2) { if (lAttrData[i] == type) { value += lAttrData[i + 1]; } if (Type == EffectType.PhyAttack && lAttrData[i] == (int)EffectType.AddCurAngerAttack) { Life l = CM.GetLifeM(m_SceneID, LifeMType.SOLDIER); value += (int)(l.Anger * 1.0f / l.m_Attr.FullAnger * lAttrData[i + 1]); } } return(value); }
public WalkDir GetHideDir(Life target) { Life life = CM.GetLifeM(m_SceneID, LifeMType.SOLDIER); if (life is Role) { Role parent = life as Role; if (parent.m_Attr.IsHide && target is Role) { if (target.WalkDir == WalkDir.WALKLEFT) { MapGrid lg = target.GetMapGrid().Right; while (lg != null) { if (lg.Type == GridType.GRID_NORMAL) { if (lg.IsAttackStations()) { List <int> samelist = new List <int>(); List <int> unsamelist = new List <int>(); lg.GetCampRoleList(parent.m_Core.m_Camp, ref samelist, ref unsamelist); if (unsamelist.Count <= 0) { return(target.WalkDir); } break; } else { lg = lg.Right; } } else { break; } } } else if (target.WalkDir == WalkDir.WALKRIGHT) { MapGrid rg = target.GetMapGrid().Left; while (rg != null) { if (rg.Type == GridType.GRID_NORMAL) { if (rg.IsAttackStations()) { List <int> samelist = new List <int>(); List <int> unsamelist = new List <int>(); rg.GetCampRoleList(parent.m_Core.m_Camp, ref samelist, ref unsamelist); if (unsamelist.Count <= 0) { return(target.WalkDir); } break; } else { rg = rg.Left; } } else { break; } } } } } return(life.WalkDir); }
protected List <NDAttribute> GetBuildRoomAttr(FloorType type, int layer, int unit) { List <NDAttribute> l = new List <NDAttribute>(); Int2 Pos = new Int2(unit, layer); if (type == FloorType.top) { Pos.Layer = Pos.Layer - 1; if (Pos.Layer < 0) { Pos.Layer = 0; } Pos.Unit += MapGrid.m_UnitRoomGridNum / 2; } else if (type == FloorType.left) { Pos.Unit += MapGrid.m_UnitRoomGridNum / 2; } else if (type == FloorType.right) { Pos.Unit -= MapGrid.m_UnitRoomGridNum / 2; } else { Pos.Unit += MapGrid.m_UnitRoomGridNum / 2; } MapGrid m = MapGrid.GetMG(Pos); if (m != null) { int BuildRoomSceneID = -1; if (m.GetBuildRoom(ref BuildRoomSceneID) == true) { Life buildRoom = CM.GetLifeM(BuildRoomSceneID, LifeMType.BUILD); //Debug.Log("floor: " + layer + "," + unit + "," + m_SceneID + ",buildroom:" + buildRoom.m_Attr.Pos + "," + buildRoom.SceneID); if (buildRoom != null) { l.Add(buildRoom.m_Attr); //FloorLife.m_rooms.Add(buildRoom as Building); } } } if (type == FloorType.Normal) { if (Pos.Layer > 0) { Pos.Layer = Pos.Layer - 1; Pos.Unit += MapGrid.m_UnitRoomGridNum / 2; MapGrid m1 = MapGrid.GetMG(Pos); if (m1 != null) { int BuildRoomSceneID = -1; if (m1.GetBuildRoom(ref BuildRoomSceneID) == true) { Life buildRoom = CM.GetLifeM(BuildRoomSceneID, LifeMType.BUILD); //Debug.Log("floor: " + layer + "," + unit + "," + m_SceneID + ",buildroom:" + buildRoom.m_Attr.Pos + "," + buildRoom.SceneID); if (buildRoom != null) { l.Add(buildRoom.m_Attr); //FloorLife.m_rooms.Add(buildRoom as Building); } } } } } return(l); }
public void SeachTarget() { if (m_Owner.m_Status.HaveState(StatusType.RunAway)) { m_run.PathAI(m_Owner.GetMapGrid(), m_Owner.RunPos, m_Owner.m_Attr); return; } bool IsTault = false; int tSceneID = m_Owner.m_Status.GetResalseSceneID(StatusType.Taunt); Life t = CM.GetLifeM(tSceneID, LifeMType.SOLDIER); if (t != null && t is Role && t.InBoat && m_Owner.CheckTarget(t)) { IsTault = true; } else { tSceneID = -1; } if (m_Owner.m_Status.HaveState(StatusType.FakeTaunt)) { LifeMCamp camp = m_Owner.m_Core.m_Camp == LifeMCamp.ATTACK ? LifeMCamp.DEFENSE : LifeMCamp.ATTACK; List <Life> l = new List <Life>(); ///需要排除隐形 。。。。。。。。。。。。。。。。。。 CM.SearchLifeMListInBoat(ref l, LifeMType.SOLDIER, camp); foreach (Role r in l) { if (r.m_Status.HaveState(StatusType.Mark)) { t = r; IsTault = true; } } } // if (m_Owner.m_isDead) { return; } if (m_Owner.m_Core.m_Camp == LifeMCamp.ATTACK && (m_Owner.m_Attr.AttrType != 3000 || !m_Owner.m_bReachGold)) { if (IsTault) { m_Owner.m_TargetisAttack = false; m_Owner.ChangeTarget(ChangeTargetReason.Taunt, t); #if UNITY_EDITOR_LOG FileLog.write(m_Owner.SceneID, "SeachTarget + m_Owner.Target = t;"); #endif SeachPath(t); } if (m_Owner.Target != null && (m_Owner.Target != null && !m_Owner.Target.isDead && m_Owner.m_TargetisAttack)) { SeachPath(m_Owner.Target); } else if (m_Owner.m_Attr.IsHide) { if (m_Owner.m_target == null || (m_Owner.m_target != null && m_Owner.m_target.isDead)) { int TargetSceneID = m_RadarAI.GetSearchTarget(tSceneID, m_Owner.GetMapGrid(), m_Owner.m_Attr.AttackLike); m_Owner.m_TargetisAttack = false; #if UNITY_EDITOR_LOG FileLog.write(m_Owner.SceneID, "SeachTarget + CM.GetAllLifeM(TargetSceneID,LifeMType.ALL)"); #endif m_Owner.ChangeTarget(ChangeTargetReason.RadarSearchTarget, CM.GetAllLifeM(TargetSceneID, LifeMType.ALL)); //m_Owner.Target = CM.GetAllLifeM(TargetSceneID,LifeMType.ALL); } if (m_Owner.Target != null && !m_Owner.Target.isDead) { MapGrid End = m_Owner.Target.GetTargetMapGrid(); if (m_Owner.Target is Role) { MapGrid g = End; if (m_Owner.Target.WalkDir == WalkDir.WALKRIGHT) { g = g.Left; while (g != null) { if (g.Type == GridType.GRID_NORMAL) { if (g.IsAttackStations()) { End = g; break; } else { g = g.Left; } } else { break; } } } else if (m_Owner.Target.WalkDir == WalkDir.WALKLEFT) { g = g.Right; while (g != null) { if (g.Type == GridType.GRID_NORMAL) { if (g.IsAttackStations()) { End = g; break; } else { g = g.Right; } } else { break; } } } } if (End != null) { m_run.PathAI(m_Owner.GetMapGrid(), End, m_Owner.m_Attr); } } else { m_run.CheackIdlePath(); } } else if (m_Owner.Target != null && (m_Owner.Target != null && m_Owner.Target is Role && !m_Owner.Target.isDead && m_Owner.TargetAttacked)) { Role roletarget = m_Owner.Target as Role; //Debug.Log(m_Owner.SceneID + "," +m_Owner.GetMapPos() + "," + roletarget.GetMapPos() + "," + roletarget.transform.localPosition + "," + m_Owner.transform.localPosition + "," +m_Owner.PropAttackSkillInfo.m_distance * MapGrid.m_width / MapGrid.m_Pixel); if (NdUtil.IsLifeSampMapLayer(roletarget, m_Owner.GetMapPos()) && Mathf.Abs(roletarget.m_thisT.localPosition.x - m_Owner.m_thisT.localPosition.x) - 0.25f < m_Owner.PropAttackSkillInfo.m_distance * MapGrid.m_width / MapGrid.m_Pixel) { SeachPath(m_Owner.Target); } else { m_Owner.m_TargetisAttack = false; SeachPath(CM.GoldBuild, true); } } else { m_Owner.m_TargetisAttack = false; SeachPath(CM.GoldBuild, true); } } else { if (m_Owner.m_target == null || (m_Owner.m_target != null && m_Owner.m_target.isDead) || (IsTault && m_Owner.m_target != t)) { #if UNITY_EDITOR_LOG string str = "SeachTarget new old:" + m_Owner.m_target + "," + m_Owner.m_TargetAttacked + m_Owner.GetMapPos(); if (m_Owner.m_target != null) { str += "," + m_Owner.m_target.isDead; } #endif int TargetSceneID = m_RadarAI.GetSearchTarget(tSceneID, m_Owner.GetMapGrid(), m_Owner.m_Attr.AttackLike); m_Owner.m_TargetisAttack = false; m_Owner.ChangeTarget(ChangeTargetReason.RadarSearchTarget, CM.GetAllLifeM(TargetSceneID, LifeMType.ALL)); #if UNITY_EDITOR_LOG FileLog.write(m_Owner.SceneID, str + " new " + m_Owner.m_target); #endif } #if UNITY_EDITOR_LOG FileLog.write(m_Owner.SceneID, "SeachTarget old " + m_Owner.m_target); #endif SeachPath(); } }
/// <summary> /// 发送炮弹兵 /// </summary> public static bool Fire(List <Vector3> lFlyPoint, int RoleID, SoldierInfo Soldier, bool IsPlayer) { if (Soldier == null || lFlyPoint == null || lFlyPoint.Count < 3) { return(false); } Role SoldierRole = null; int sceneID = CM.DataID2SceneIDInSoldier(RoleID); Life life = CM.GetLifeM(sceneID, LifeMType.SOLDIER); if (life == null) { int RoleType = Soldier.m_modeltype; if (RoleType == 102003) { RoleType = 1020032; } if (RoleType == 200009) { RoleType = 2000092; } string SoldierName = Soldier.m_name; Transform FlyNode = BattleEnvironmentM.GetLifeMBornNode(false); FlyNode.position = new Vector3(FlyNode.position.x, FlyNode.position.y, -0.5f); //IGameRole i = GameRoleFactory.Create(FlyNode, RoleType, SoldierName, AnimatorState.Fly00000); SoldierRole = LifeFactory.CreateRole(FlyNode, AnimatorState.Fly00000, Soldier, LifeMCamp.ATTACK, RoleID, MoveState.Fly, Int2.zero, LifeEnvironment.Combat); GameObject go = SoldierRole.RoleSkinCom.tRoot.gameObject; RoleColider col = SoldierRole.RoleSkinCom.tBody.gameObject.GetComponent <RoleColider>(); col.EnableColider(ColiderType.Fire, true); Vector3 dir = lFlyPoint[1] - lFlyPoint[0]; if (dir.x <= 0) { SoldierRole.RoleSkinCom.SetMirror(1, 1, 1); } else { SoldierRole.RoleSkinCom.SetMirror(-1, 1, 1); } } else { life.SetActive(true); SoldierRole = life as Role; SoldierRole.m_bReBorn = false; } if (SoldierRole != null) { if (IsPlayer) { GodSkillWnd gsw = WndManager.FindDialog <GodSkillWnd>(); if (gsw != null) { gsw.ChangeBiaoqing((int)CaptionExpress.fire); } } if (SoldierRole.MoveAI != null && SoldierRole.MoveAI is Fly) { (SoldierRole.MoveAI as Fly).SetTrailFly(lFlyPoint); PlayFlyMusic(Soldier.m_modeltype); } } return(true); }