/// <summary> /// 确认是否为初始品阶 /// </summary> public static bool CheckStartQuality(int Quality) { List <int> l = new List <int>(); string value = GetParaStr(24, 1); if (string.IsNullOrEmpty(value) == true) { return(false); } int length = NdUtil.GetLength(value); for (int i = 0; i < length; i++) { l.Add(NdUtil.GetIntValue(value, i)); } if (l[0] == Quality) { return(true); } else { return(false); } }
/// <summary> /// 获取下一个轮询技能ID /// </summary> /// <returns></returns> private int GetNextSkillOrderID() { int N = m_AttackTimes++; if (string.IsNullOrEmpty(m_attack1) || string.IsNullOrEmpty(m_attack2) || N <= 0) { Debug.LogError("数据非法 " + N); return(-1); } else { int M = m_attack1.Length; int P = m_attack2.Length; if (N <= M) { return(NdUtil.GetNumIndex(m_attack1, N)); } else { int Q = (N - M) % P; if (Q == 0) { Q = P; } return(NdUtil.GetNumIndex(m_attack2, Q)); } } }
/// <summary> /// 获取下一个品阶 /// </summary> public static int GetNextQuality(int Quality) { List <int> l = new List <int>(); string value = GetParaStr(24, 1); if (string.IsNullOrEmpty(value) == true) { return(10); } int length = NdUtil.GetLength(value); for (int i = 0; i < length; i++) { l.Add(NdUtil.GetIntValue(value, i)); } for (int i = 0; i < l.Count; i++) { if (l[i] == Quality) { if (i == l.Count - 1) { return(l[l.Count - 1]); } else { return(l[i + 1]); } } } return(0); }
/// <summary> /// 设置lifeM 核心结构 /// </summary> /// <returns></returns> public virtual int SetLifeCore(LifeMCore Core) { m_SceneID = NdUtil.GetSceneID(); m_Core.Copy(Core); CM.JoinCombat(m_SceneID, this, Core); return(m_SceneID); }
/// <summary> /// 手势移动中 /// </summary> /// <param name="gesture"></param> public void FingerMove(Vector3 posWorld) { if (s_bEnableFire == false) { return; } if (!PlayerSoldierFire.s_bCollectTouchPoint) { return; } if (CmCarbon.IsBorn(soldierDataID)) { return; } int nTouchCount = m_v3TouchPostions.Count; if (nTouchCount > 0) { Vector3 oldPos = m_v3TouchPostions[m_v3TouchPostions.Count - 1]; if (NdUtil.V3Equal(posWorld, oldPos)) { return; } } if (isTrace && m_goFingerTrail) { m_goFingerTrail.transform.position = posWorld; } if (NdUtil.V3Equal(posWorld, Vector3.zero)) { return; } m_v3TouchPostions.Add(posWorld); }
/// <summary> /// 获取2个对象之间的夹角 /// </summary> public static float GetAngle(Life Self, Life Target) { Vector3 from = Self.GetCenterPos(); Vector3 to = Target.GetCenterPos(); return(NdUtil.V2toAngle(from, to, Vector3.right)); }
void RefreshUI() { int currentPhysics = UserDC.GetPhysical(); int total = UserM.GetMaxPhysical(UserDC.GetLevel()); if (currentPhysics >= total) { SetType(0); } else { SetType(1); } int serverTime = GlobalTimer.GetNowTimeInt(); NGUIUtil.SetLableText <string>(MyHead.LblTime, NdUtil.ConvertServerTime(serverTime)); if (m_iType == 1) { int resumePhysicsTime = GlobalTimer.instance.GetPhysicsResumeCounter(); NGUIUtil.SetLableText <string>(MyHead.LblNextResumeTime, NdUtil.TimeFormat(resumePhysicsTime)); int resumePhysicsAllTime = GlobalTimer.instance.GetPhysicsResumeAllCounter(); NGUIUtil.SetLableText <string>(MyHead.LblResumeAllTime, NdUtil.TimeFormat(resumePhysicsAllTime)); } }
protected override void TriggerSkillTime(ref List <Life> RoleList, ref float fReleaseDelay) { fReleaseDelay = 0.25f; bool IsRelease = false; if (RoleList.Count > 0) { SetAnimator(Build_AnimatorState.Trigger30000); { Life w = RoleList[0]; Vector3 posSrc = m_goPao.transform.position; Vector3 posRole = new Vector3(w.GetPos().x, w.GetPos().y, w.GetPos().z); float fgreed = NdUtil.V2toAngle(posSrc, posRole, Vector3.right); if (fgreed < 0f || fgreed > 270) { fgreed = 0f; } else if (fgreed > 180f) { fgreed = 180f; } m_vDirGreed = new Vector3(0, -fgreed, 0); } m_bAttack = true; m_fAttackTime = Time.time; m_goEffect1912011.SetActive(true); SoundPlay.Play("trap_cannon_sky", false, false); } }
/// <summary> /// 释放技能主逻辑 /// </summary> protected override bool ReleaseSkill(ref List <Life> RoleList, ref int nAttackIndex) { bool IsRelease = false; if (RoleList.Count > 0) { IsRelease = true; { Life w = RoleList[0]; Vector3 posSrc = m_goPao.transform.position; Vector3 posRole = new Vector3(w.GetPos().x, w.GetPos().y, w.GetPos().z); float fgreed = NdUtil.V2toAngle(posSrc, posRole, Vector3.right); if (fgreed < 0f || fgreed > 270) { fgreed = 0f; } else if (fgreed > 180f) { fgreed = 180f; } m_vDirGreed = new Vector3(0, -fgreed, 0); bool InterruptSkill = false; GridActionCmd action = null; if (w is Role) { action = (w as Role).CurrentAction; } SkillReleaseInfo Info = m_Skill.SkillRelease(this, w, action, m_Skill.PropSkillInfo); w.ApplyDamage(Info, m_thisT); } } return(IsRelease); }
/// <summary> /// 获取设置状态 /// </summary> public static void SetSkillStatus(ref List <SkillStatusInfo> lstatus, string strStatus) { if (lstatus == null) { lstatus = new List <SkillStatusInfo>(); } if (string.IsNullOrEmpty(strStatus) == true || strStatus == "0") { return; } int length = NdUtil.GetLength(strStatus); for (int i = 0; i < length; ++i) { int statusid = NdUtil.GetIntValue(strStatus, i); s_statusInfo stainfo = GetSkillStatus(statusid); if (stainfo != null) { SkillStatusInfo ss = new SkillStatusInfo(); if (SetSkillStatus(stainfo, ref ss) == true) { lstatus.Add(ss); } } } }
/// <summary> /// 添加文本和数值 数据(type 1 百分比 / 2 千分比 ) /// </summary> private void AddTextData(string text1, string text2, float data1, float data2, int type1 = 0, int type2 = 0) { if (data1 != 0) { if (type1 == 0) { m_lHeroDescData.Add(new DescData(text1, data1.ToString())); } else if (type1 == 1) { m_lHeroDescData.Add(new DescData(text1, NdUtil.ConvertPercent(data1))); } else if (type1 == 2) { m_lHeroDescData.Add(new DescData(text1, NdUtil.ConvertPermillage(data1))); } } if (data2 != 0) { if (type2 == 0) { m_lHeroDescData.Add(new DescData(text2, data1.ToString())); } else if (type2 == 1) { m_lHeroDescData.Add(new DescData(text2, NdUtil.ConvertPercent(data2))); } else if (type2 == 2) { m_lHeroDescData.Add(new DescData(text2, NdUtil.ConvertPermillage(data2))); } } }
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> protected override bool ReleaseSkill(ref List <Life> RoleList, ref int nAttackIndex) { bool IsRelease = false; if (RoleList.Count > 0) { IsRelease = true; SetAnimator(Build_AnimatorState.Trigger30000); //foreach(Life w in RoleList) { Life w = RoleList[0]; Vector3 posSrc = Pao.transform.position; Vector3 posRole = new Vector3(w.GetPos().x, w.GetPos().y, w.GetPos().z); float fgreed = NdUtil.V2toAngle(posSrc, posRole, Vector3.right); m_vDirGreed = new Vector3(fgreed, 90f, 0); bool InterruptSkill = false; GridActionCmd action = null; if (w is Role) { action = (w as Role).CurrentAction; } SkillReleaseInfo Info = m_Skill.SkillRelease(this, w, action, m_Skill.PropSkillInfo); w.ApplyDamage(Info, m_thisT); } m_bAttack = true; m_fAttackTime = Time.time; ActiveEffect1915011(true); } return(IsRelease); }
/// <summary> /// 获取最后的飞行方向 /// </summary> public float GetFlyDirAngel() { float angle = Vector3.Angle(m_FlyDir, Vector3.left); angle = Vector3.Dot(m_FlyDir, Vector3.up) < 0 ? angle : -angle; angle = NdUtil.ClampAngle(angle, 0, 360f); return(angle); }
public bool CheckAttackPos() { MapGrid attackstation = MapGrid.GetMG(m_AttackStation); if (NdUtil.IsSameMapPos(MapPos, m_AttackStation) && attackstation.IsAttackStations()) { List <int> samelist = new List <int>(); List <int> unsamelist = new List <int>(); attackstation.GetCampRoleList(m_parent.m_Core.m_Camp, ref samelist, ref unsamelist); if (unsamelist.Count > 0) { if (!m_FindAttackpos) { #if UNITY_EDITOR_LOG FileLog.write(m_SceneID, "CheckAttackPos" + Path.Indext + "," + m_ForceGrid + "," + m_NGrid + "," + MapPos + "," + m_AttackStation + "," + m_NAttackStation + "," + m_Attack + "," + RoleParent.m_Skill.CanAttack() + "," + Time.realtimeSinceStartup); #endif m_FindAttackpos = true; (m_parent as Role).ChangeTarget(ChangeTargetReason.ClearTarget, null); MapGrid g = GetCanAttackStation(); if (g != null && (!Life.ServerMode || !m_parent.WaitServer)) { ClearPath(); Path.PathAI(m_SceneID, MapGrid.GetMG(MapPos), g, m_parent.m_Attr as RoleAttribute, CurrentGS, WalkDIR); PathInit(); } else { #if UNITY_EDITOR_LOG //Debug.Log("没有空闲攻击位 " + MapPos ); #endif } /*//判断首个节点是否为楼梯 * PathData Road = Path.GetPathData(PathAccess.Cur); * if(Road != null && Road.state == RoleState.STAIR) * { * m_Reject = true; * m_DoUpatePath = false; * } * * //获取路线上的下一个攻击位,包含当前路径点 * ErrorInfo Error = new ErrorInfo(); * PathData NextAttackStation = Path.GetNextAttackPosCurInPath(ref Error); * if(NextAttackStation != null) * { * m_AttackStation = NextAttackStation.Road.GridPos; * m_NAttackStation = NextAttackStation.Road.GridPos; * }*/ FirstCheckAttack(); } return(false); } } return(true); }
private void SetFloorCore() { //SetFloorType(); bool IsPlayer = CmCarbon.GetCamp2Player(LifeMCamp.DEFENSE); m_Core = new LifeMCore(NdUtil.GetSceneID(), IsPlayer, LifeMType.FLOOR, LifeMCamp.DEFENSE, MoveState.Static); SetLifeCore(m_Core); m_Attr = new FloorAttribute(); m_Attr.Init(SceneID, m_Core, this); }
private void SetParam() { m_lParam.Clear(); List <int> l = new List <int>(); if (string.IsNullOrEmpty(m_param) == true) { return; } if (m_param != null) { int length = NdUtil.GetLength(m_param); for (int i = 0; i < length; i++) { l.Add(NdUtil.GetIntValue(m_param, i)); } } //m_shape 0表示无需触发,只需cd状态到后可触发。1=目标攻击,2=圆形攻击,3=环形攻击,4=矩形攻击,5=目标范围圆形攻击 if (m_shape == 1 || m_shape == 5) { if (l.Count == 1) { m_lParam.Add(l[0] * MapGrid.m_width / MapGrid.m_Pixel); } } //按圆形 else if (m_shape == 2) { if (l.Count == 3) { m_lParam.Add(l[0] * 1.0f); m_lParam.Add(l[1] * 1.0f); m_lParam.Add(l[2] * MapGrid.m_width / MapGrid.m_Pixel); } } //按环形 else if (m_shape == 3) { if (l.Count == 4) { m_lParam.Add(l[0] * 1.0f); m_lParam.Add(l[1] * 1.0f); m_lParam.Add(l[2] * MapGrid.m_width / MapGrid.m_Pixel); m_lParam.Add(l[3] * MapGrid.m_width / MapGrid.m_Pixel); } } //按矩形 else if (m_shape == 4) { if (l.Count == 2) { m_lParam.Add(l[0] * MapGrid.m_width / MapGrid.m_Pixel); m_lParam.Add(l[1] * MapGrid.m_width / MapGrid.m_Pixel); } } }
private static string GetParaStrValue(int id, int strIndex, int index) { string value = GetParaStr(id, index); if (string.IsNullOrEmpty(value) == true) { return(string.Empty); } return(NdUtil.GetStrValue(value, index)); }
/// <summary> /// Floor不加入cm列表 /// </summary> /// <author>zhulin</author> public override int SetLifeCore(LifeMCore Core) { m_SceneID = NdUtil.GetSceneID(); m_Core.Copy(Core); if (IsCanAttack) { InBoat = true; CM.JoinCombat(m_SceneID, this, m_Core); } return m_SceneID; }
/// <summary> /// 注意索引开始顺序(为了和常量表字段名称保持一致) /// </summary> /// <param name="id">id索引从1开始</param> /// <param name="strIndex">strIndex索引从1开始</param> /// <param name="index">索引从0开始</param> /// <returns></returns> private static int GetParaStrToInt(int id, int strIndex, int index) { string value = GetParaStr(id, strIndex); if (string.IsNullOrEmpty(value) == true) { return(-1); } return(NdUtil.GetIntValue(value, index)); }
public override void Update() { base.Update(); if (m_TimeCount < m_fDelay) { m_LifePrent.m_thisT.transform.position = start; return; } if (m_TimeCount < (m_fDelay + 3.02f)) { if ((m_TimeCount - m_Delatime) <= m_fDelay) { SoundPlay.Play("back_ship", false, false); //SkillEffects._instance.LoadEffect("effect/prefab/", "2000201", start, 1.5f, dolphineDir); GameObjectActionExcute gae = EffectM.LoadEffect("effect/prefab/", m_effectName, start, null); if (gae != null) { GameObjectActionEffectInit effectinit = new GameObjectActionEffectInit(); //effectinit.SetEffectMirror(dolphineDir); gae.AddAction(effectinit); GameObjectActionDelayDestory ndEffect = new GameObjectActionDelayDestory(1.5f); gae.AddAction(ndEffect); } } Vector3 pos = bezier.GetPointAtTime((m_TimeCount - m_fDelay) / 3.0f); float Angles = NdUtil.V2toAngle(pos, bezier.GetPointAtTime((m_TimeCount - m_fDelay) / 3.0f + 0.01f), Vector3.right) + 180; m_curangle = NdUtil.ClampAngle(Angles + 180, 0, 360f); //Debug.Log(m_curangle); if (m_bRotate) { if (dolphineDir == WalkDir.WALKRIGHT) { m.SetAngle(-Angles); } else { m.SetAngle(Angles); } } PlayAction(AnimatorState.Fly00000, pos, true); //NGUIUtil.DebugLog(m_TimeCount.ToString()); //if (m_TimeCount >= 0.4f && m_TimeCount < 0.4f +Time.deltaTime) //{ // m_Skin.ProPerty.EnableTrail(true); //} } else { //PlayAction(AnimatorState.Fly00000, bezier.GetPointAtTime(1), true); //MoveAction(AnimatorState.Fly00000, Vector3.down * m_LifePrent.m_Attr.Flyspeed * Time.deltaTime, ActionMode.Delta); MoveAction(AnimatorState.Fly00000, Vector3.down * 10 * Time.deltaTime, ActionMode.Delta); } }
/// <summary> /// 设置状态 /// </summary> private static bool SetSkillStatus(s_statusInfo stainfo, ref SkillStatusInfo Info) { if (stainfo == null || Info == null) { return(false); } Info.m_persistence = stainfo.persistence; Info.m_id = stainfo.id; Info.m_name = stainfo.name; Info.m_type = stainfo.type; if (string.IsNullOrEmpty(stainfo.effect) == false && stainfo.effect != "0") { int length = NdUtil.GetLength(stainfo.effect); for (int i = 0; i < length; ++i) { Info.m_effect.Add(NdUtil.GetIntValue(stainfo.effect, i)); } } Info.m_effectlevel = stainfo.effectlevel; Info.m_time = stainfo.time; Info.m_timeinterval = stainfo.timeinterval; Info.m_effectid = stainfo.effectid; Info.m_condition = stainfo.condition; Info.m_position = stainfo.position; Info.m_data0 = stainfo.data0; Info.m_data1 = stainfo.data1; Info.m_skill1type = stainfo.skill1type; Info.m_level1 = stainfo.level1; Info.m_skill2type = stainfo.skill2type; Info.m_level2 = stainfo.level2; Info.m_bufftype = stainfo.bufftype; s_statusreplaceInfo replace = GetSkillStatusReplace(Info.m_type, Info.m_effect.Count > 0 ? Info.m_effect[0] : 0, Info.m_bufftype); if (replace != null) { Info.m_RelpaceInfo = new SkillStatusReplaceInfo(); Info.m_RelpaceInfo.m_id = replace.id; Info.m_RelpaceInfo.m_statustype = replace.statustype; Info.m_RelpaceInfo.m_effect = replace.effect; Info.m_RelpaceInfo.m_name = replace.name; Info.m_RelpaceInfo.m_type = replace.type; Info.m_RelpaceInfo.m_compatible = replace.compatible; Info.m_RelpaceInfo.m_reppriority = replace.reppriority; Info.m_RelpaceInfo.m_spepriority = replace.spepriority; Info.m_RelpaceInfo.m_bufftype = replace.bufftype; Info.m_RelpaceInfo.m_isaction = replace.isaction; } else { Debug.Log("xxxx " + Info.m_name); } return(true); }
/// <summary> /// 游戏准备阶段 /// </summary> private static void CombatReady() { NdUtil.ResetSceneID(); CmCarbon.ResetDead(); CmCarbon.ResetFireState(); PlayerSoldierFire.soldierDataID = -1; PlayerSoldierFire.isTrace = false; m_CombatTime = CombatMaxTime * 1.0f; m_CombatTimeOut = false; m_AttackAllDead = false; m_GoldDestroy = false; }
float UpdateAimAt(bool bTriggle) { if (m_Skill.PropSkillInfo.m_LifeTarget != null && m_DurationRotate == 0) { Vector3 posSrc = new Vector3(Pao.transform.position.x, Pao.transform.position.y, -2); Vector3 vTargetPos = m_Skill.PropSkillInfo.m_vTargetPos; if (!bTriggle) { if (m_Skill.PropSkillInfo.m_LifeTarget.isDead) { vTargetPos = m_Skill.PropSkillInfo.m_vTargetPos; } else { vTargetPos = m_Skill.PropSkillInfo.m_LifeTarget.GetPos(); } } Vector3 posRole = new Vector3(vTargetPos.x, vTargetPos.y + 0.5f, -2); m_fdistance = Vector3.Distance(posSrc, posRole); float fgreed = NdUtil.V2toAngle(posSrc, posRole, Vector3.right); if (m_vCurGreed.x < 0) { m_vCurGreed.x = 360f + m_vCurGreed.x; } else if (m_vCurGreed.x > 360f) { m_vCurGreed.x = m_vCurGreed.x - 360f; } m_vStartGreed = m_vCurGreed; m_vDirGreed = new Vector3(fgreed, 90f, 0); float fGreeddistance = m_vStartGreed.x - m_vDirGreed.x; fGreeddistance = fGreeddistance > 0 ? fGreeddistance : -fGreeddistance; if (fGreeddistance > 180f) { if (m_vStartGreed.x > m_vDirGreed.x) { m_vDirGreed.x += 360f; } else if (m_vStartGreed.x < m_vDirGreed.x) { m_vDirGreed.x -= 360f; } fGreeddistance = 360f - fGreeddistance; } m_DurationRotate = fGreeddistance / m_fGunRotateSpeed; m_bTriggle = bTriggle; } return(m_DurationRotate); }
public override void SetCore() { bool IsPlayer = CmCarbon.GetCamp2Player(LifeMCamp.DEFENSE); m_Core = new LifeMCore(NdUtil.GetSceneID(), IsPlayer, LifeMType.WALL, LifeMCamp.DEFENSE, MoveState.Static); SetLifeCore(m_Core); m_Attr = new FloorAttribute(); m_Attr.Init(SceneID, m_Core, this); m_Attr.StartPos = new Int2(StartUnit, Layer); HP = fullHP; }
/// <summary> /// 每秒刷新技能点恢复倒计时 /// </summary> private void RefreshUIBySecond() { int resumeSkillTime = GlobalTimer.instance.GetSkillResumeCounter(); if (m_wndType == 1) { string timeStr = string.Format("({0})", NdUtil.TimeFormat(resumeSkillTime)); NGUIUtil.SetLableText <string>(MyHead.LblResumeTimeNotFull, timeStr); } else if (m_wndType == 2) { NGUIUtil.SetLableText <string>(MyHead.LblResumeTimeEmpty, NdUtil.TimeFormat(resumeSkillTime)); } }
//获取雷达消耗 public static int GetRadarDiamond(int times) { string value = GetParaStr(23, 1); int length = NdUtil.GetLength(value); if (times < length) { return(NdUtil.GetIntValue(value, times)); } else { return(NdUtil.GetIntValue(value, length - 1)); } }
/// <summary> /// 是否在路径上 /// </summary> public bool InRoad(Int2 pos) { for (int i = m_Index; i < PathCount; i++) { if (NdUtil.IsSameMapPos(pos, Path[i].Road.GridPos) == true) { return(true); } } if (PathCount <= 0) { return(true); } return(false); }
/// <summary> /// 获取当前年月所有奖励数据 /// </summary> public static List <s_signinInfo> GetCurSignInData() { List <s_signinInfo> m_lData = new List <s_signinInfo>(); string nowTime = NdUtil.ConvertServerTimeYYMM(); foreach (s_signinInfo info in m_lSignIn) { if (info.id.ToString().Substring(0, 6) == nowTime) { m_lData.Add(info); } } SortSingIn(ref m_lData); return(m_lData); }
/// <summary> /// 召唤物 /// </summary> public void SetBorn(Life Parent, int SummonProsID, PetInfo info, MapGrid pos) { m_Parent = Parent; m_info = info; m_MapGrid = pos; m_Pos = pos.GridPos; m_Skill = new InheritSummonProsSkill(info, this); m_Attr = new InheritSummonProsAttribute(); m_SceneID = NdUtil.GetSceneID(); m_Core = new LifeMCore(info.m_id, Parent.m_Core.m_IsPlayer, LifeMType.INHERITSUMMONPROS, Parent.m_Core.m_Camp, MoveState.Walk); m_Skill.Init(m_SceneID, m_Core); (m_Attr as InheritSummonProsAttribute).InheritInit(m_SceneID, m_Core, this, Parent); SetLifeCore(m_Core); InBoat = false; }