public MonsterRole FindNearestFakeMonster(Vector3 pos) { float dis = 9999999f; MonsterRole role = null; foreach (MonsterRole m in m_mapFakeMonster.Values) { if (m.isDead || m is CollectRole || (m is MS0000 && ((MS0000)m).owner_cid == PlayerModel.getInstance().cid) || (m is MDC000 && ((MDC000)m).escort_name == A3_LegionModel.getInstance().myLegion.clname)) { continue; } if (m is MDC000 && (int)(((float)((MDC000)m).curhp / (float)((MDC000)m).maxHp) * 100) <= 20) { continue; } Vector3 off_pos = m.m_curPhy.position - pos; float off_dis = off_pos.magnitude; if (off_dis < SelfRole._inst.m_LockDis && off_dis < dis) { //debug.Log("遍历怪物位置"); dis = off_dis; role = m; } } return(role); }
public MonsterRole FindNearestFakeMonster(Vector3 pos) { float num = 9999999f; MonsterRole result = null; foreach (MonsterRole current in this.m_mapFakeMonster.Values) { bool flag = current.isDead || current is CollectRole || (current is MS0000 && (long)((MS0000)current).owner_cid == (long)((ulong)ModelBase <PlayerModel> .getInstance().cid)) || (current is MDC000 && ((MDC000)current).escort_name == ModelBase <A3_LegionModel> .getInstance().myLegion.clname); if (!flag) { bool flag2 = current is MDC000 && (int)((float)((MDC000)current).curhp / (float)((MDC000)current).maxHp * 100f) <= 20; if (!flag2) { float magnitude = (current.m_curPhy.position - pos).magnitude; bool flag3 = magnitude < SelfRole._inst.m_LockDis && magnitude < num; if (flag3) { num = magnitude; result = current; } } } } return(result); }
public void pos_correct(Variant msgData) { debug.Log("KKKKUUUUU" + msgData.dump()); uint @uint = msgData["iid"]._uint; ProfessionRole otherPlayer = OtherPlayerMgr._inst.GetOtherPlayer(@uint); bool flag = otherPlayer != null; if (!flag) { float x = msgData["x"]._float / 53.333f; float z = msgData["y"]._float / 53.333f; MonsterRole serverMonster = MonsterMgr._inst.getServerMonster(@uint); bool flag2 = serverMonster != null; if (flag2) { Vector3 vector = new Vector3(x, serverMonster.m_curModel.position.y, z); bool flag3 = GameRoomMgr.getInstance().curRoom == GameRoomMgr.getInstance().dRooms[3342u]; if (flag3) { serverMonster.pos_correct(vector); } else { NavMeshHit navMeshHit; NavMesh.SamplePosition(vector, out navMeshHit, 100f, serverMonster.m_layer); serverMonster.pos_correct(navMeshHit.position); } } } }
private MonsterRole Update(MonsterRole monsterRole) { List <MonsterRole> allRoles = GetAll(); MonsterRole roleToUpdate = allRoles.Find(existingMonsterRole => existingMonsterRole.Id == monsterRole.Id); if (roleToUpdate == null) { throw new Exception("Failed to update monster role: The given monster role was not found"); } roleToUpdate.HpPercentWeight = monsterRole.HpPercentWeight; roleToUpdate.AtkPercentWeight = monsterRole.AtkPercentWeight; roleToUpdate.DefPercentWeight = monsterRole.DefPercentWeight; roleToUpdate.ExpectedBaseHp = monsterRole.ExpectedBaseHp; roleToUpdate.ExpectedBaseAtk = monsterRole.ExpectedBaseAtk; roleToUpdate.ExpectedBaseDef = monsterRole.ExpectedBaseDef; roleToUpdate.SpdWeight = monsterRole.SpdWeight; roleToUpdate.CritRateWeight = monsterRole.CritRateWeight; roleToUpdate.CritDmgWeight = monsterRole.CritDmgWeight; roleToUpdate.ResistanceWeight = monsterRole.ResistanceWeight; roleToUpdate.AccuracyWeight = monsterRole.AccuracyWeight; WriteRoles(allRoles); return(roleToUpdate); }
//public void sendmoveto(float frm_x, float frm_y, float to_x, float to_y, float start_tm,bool force=false) //{ // //Variant msg = Variant.alloc(); // //msg["frm_x"] = frm_x; // //msg["frm_y"] = frm_y; // //msg["to_x"] = to_x; // //msg["to_y"] = to_y; // //msg["start_tm"] = start_tm; // //sendRPC(PKG_NAME.C2S_MOVE, msg); // //Variant.free(msg); // ReqChangeMoveMsg((uint)frm_x, (uint)frm_y, (uint)to_x, (uint)to_y, (uint)start_tm,-1f, force); //} //public void sendmoveRadian(float frm_x, float frm_y, float radian, float start_tm) //{ // //float ori = (radian * 180) / (float)(Math.PI * 100); // LGMap lgm = GRClient.instance.g_gameM.getObject(OBJECT_NAME.LG_MAP) as LGMap; // Vec2 tp = lgm.getFarthestGPosByOri(frm_x, frm_y, radian * (float)Math.PI / 180); // float to_x = (float)(tp.x ) + GameConstant.GEZI; // float to_y = (float)(tp.y ) + GameConstant.GEZI; // ReqChangeMoveMsg((uint)frm_x, (uint)frm_y, (uint)to_x, (uint)to_y, (uint)start_tm, radian); // ////if (moveTick > 20) // //{ // // // debug.Log("处理移动消息.9.."); // // // moveTick = 0; // // Variant msg = Variant.alloc(); // // msg["frm_x"] = frm_x; // // msg["frm_y"] = frm_y; // // msg["iid"] = 0; // // msg["start_tm"] = start_tm; // // msg["radian"] = radian; // // sendRPC(PKG_NAME.C2S_MOVE, msg); // // Variant.free(msg); // //} //} public void pos_correct(Variant msgData) { debug.Log("KKKKUUUUU" + msgData.dump()); uint iid = msgData["iid"]._uint; ProfessionRole pr = OtherPlayerMgr._inst.GetOtherPlayer(iid); if (pr != null) { } else { float to_x = msgData["x"]._float / GameConstant.PIXEL_TRANS_UNITYPOS; float to_y = msgData["y"]._float / GameConstant.PIXEL_TRANS_UNITYPOS; MonsterRole role = MonsterMgr._inst.getServerMonster(iid); if (role != null) { Vector3 vec = new Vector3(to_x, role.m_curModel.position.y, to_y); if (GameRoomMgr.getInstance().curRoom == GameRoomMgr.getInstance().dRooms[3342] || GameRoomMgr.getInstance().curRoom == GameRoomMgr.getInstance().dRooms[3358]) {//解决多层阻挡点寻路的问题 role.pos_correct(vec); } else { NavMeshHit hit; NavMesh.SamplePosition(vec, out hit, 100f, role.m_layer); role.pos_correct(hit.position); } } } }
public void RemoveMonster(MonsterRole role) { bool flag = !role.isfake; if (flag) { bool flag2 = !this.m_mapMonster.ContainsKey(role.m_unIID); if (flag2) { return; } MonsterRole monsterRole = this.m_mapMonster[role.m_unIID]; monsterRole.dispose(); this.m_mapMonster.Remove(role.m_unIID); } else { bool flag3 = !this.m_mapFakeMonster.ContainsKey(role.m_unIID); if (flag3) { return; } MonsterRole monsterRole2 = this.m_mapFakeMonster[role.m_unIID]; monsterRole2.dispose(); this.m_mapFakeMonster.Remove(role.m_unIID); } bool flag4 = a3_liteMinimap.instance != null; if (flag4) { a3_liteMinimap.instance.removeRoleInMiniMap(role.strIID); } this.m_listMonster.Remove(role); base.dispatchEvent(GameEvent.Create(MonsterMgr.EVENT_MONSTER_REMOVED, this, role, false)); }
public void RemoveMonster(MonsterRole role) { if (!role.isfake) { if (!m_mapMonster.ContainsKey(role.m_unIID)) { return; } MonsterRole mon = m_mapMonster[role.m_unIID]; mon.dispose(); m_mapMonster.Remove(role.m_unIID); } else { if (!m_mapFakeMonster.ContainsKey(role.m_unIID)) { return; } MonsterRole mon = m_mapFakeMonster[role.m_unIID]; mon.dispose(); m_mapFakeMonster.Remove(role.m_unIID); } if (a3_liteMiniBaseMap.instance != null) { a3_liteMiniBaseMap.instance.removeRoleInMiniMap(role.strIID); } m_listMonster.Remove(role); dispatchEvent(GameEvent.Create(MonsterMgr.EVENT_MONSTER_REMOVED, this, role)); }
public MonsterRole getMonster(uint iid) { MonsterRole role = getServerMonster(iid); if (role != null) { return(role); } return(getFakeMonster(iid)); }
public Vector3 FindNearestMonsterPos(Vector3 me) { MonsterRole role = FindNearestMonster(me); if (role != null) { return(role.m_curPhy.position); } return(Vector3.zero); }
//{ // set { minRange = value;/*Mathf.Max(value,1.5f); */} // get { return minRange; } //} public override void Enter() { if (muNetCleint.instance.CurServerTimeStamp - exe_action_tm < xml_action_tm || SelfRole._inst.isPlayingSkill) { return; } BattleProxy.getInstance().addEventListener(BattleProxy.EVENT_SELF_KILL_MON, OnKillMon); //xml_action_tm = 0.0f; CHECK_AGAIN : CheckPK(); if (!SelfRole.UnderPlayerAttack) { if (PlayerModel.getInstance().pk_state != PK_TYPE.PK_PEACE) { BaseRole plr = OtherPlayerMgr._inst.FindNearestEnemyOne(SelfRole._inst.m_curModel.transform.position, selector: EnemySelector, pkState: PlayerModel.getInstance().pk_state); if (plr != null) { SelfRole._inst.m_LockRole = plr; return; } } if ((SelfRole._inst.m_LockRole is ProfessionRole && PlayerModel.getInstance().pk_state == PK_TYPE.PK_PEACE) || SelfRole._inst.m_LockRole == null) { MonsterRole mon = MonsterMgr._inst.FindNearestMonster(/*SelfRole.fsm.Autofighting ? StateInit.Instance.Origin :*/ SelfRole._inst.m_curModel.position); if (mon == null) { SelfRole.fsm.ChangeState(StateIdle.Instance); return; } SelfRole._inst.m_LockRole = mon; } else { if (SelfRole.fsm.Autofighting && Vector3.Distance(SelfRole._inst.m_LockRole.m_curModel.position.ConvertToGamePosition(), SelfRole._inst.m_curModel.position.ConvertToGamePosition()) > StateInit.Instance.Distance) { SelfRole._inst.m_LockRole = null; SelfRole.fsm.ChangeState(StateIdle.Instance); } } return; } else { if (SelfRole.LastAttackPlayer != null) { SelfRole._inst.m_LockRole = SelfRole.LastAttackPlayer; } else { SelfRole.UnderPlayerAttack = false; goto CHECK_AGAIN; } } }
/// <summary> /// 查找指定位置最近的召唤兽 /// </summary> /// <param name="pos"></param> /// <returns></returns> public MonsterRole FindNearestSummon(Vector3 pos) { MonsterRole role = null; float dis = float.MaxValue; foreach (MonsterRole m in m_mapMonster.Values) { int ownerCid = 0; if (m is MS0000) { ownerCid = ((MS0000)m).owner_cid; } if (m.m_isMarked) { continue; } if (ownerCid == 0) { continue; } else { if (PlayerModel.getInstance().pk_state != PK_TYPE.PK_PEACE) { if (ownerCid == PlayerModel.getInstance().cid) { continue; } else if (PlayerModel.getInstance().pk_state == PK_TYPE.PK_TEAM) { if (TeamProxy.getInstance().MyTeamData != null && (TeamProxy.getInstance().MyTeamData.itemTeamDataList?.Exists((member) => member.cid == ownerCid) ?? false)) { continue; } else if (ownerCid == PlayerModel.getInstance().cid) { continue; } } } } float off_dis = (m.m_curPhy.position - pos).magnitude; if (off_dis < (SelfRole.fsm.Autofighting ? Mathf.Min(SelfRole._inst.m_LockDis, StateInit.Instance.Distance) : SelfRole._inst.m_LockDis) && off_dis < dis) { dis = off_dis; role = m; } } return(role); }
public override void Execute(float delta_time) { thinktm += delta_time; if (thinktm < 0.25f) { return; } thinktm = 0; if (isOutOfAutoPlayRange) { StateAutoMoveToPos.Instance.pos = StateInit.Instance.Origin; StateAutoMoveToPos.Instance.stopdistance = 0.3f; SelfRole.fsm.ChangeState(StateAutoMoveToPos.Instance); //SelfRole._inst.m_LockRole = null; return; } Vector3 curpos = SelfRole._inst.m_curModel.position; MonsterRole mon = MonsterMgr._inst.FindNearestMonster(/*SelfRole.fsm.Autofighting ? StateInit.Instance.Origin : */ curpos, onTask: onTaskMonsterSearch); if (mon == null) { //!--如果玩家周围没有monster,寻找新的随机的挂点 Vector3 autopoint; bool result = FindRandomPropAutoPoint(curpos, out autopoint); if (result && Vector2.Distance( new Vector2(StateInit.Instance.Origin.x, StateInit.Instance.Origin.z), new Vector2(autopoint.x, autopoint.z) ) < StateInit.Instance.Distance) { //!--圈内有挂点 if (Vector3.Distance(autopoint, curpos) <= 2.0f) { return; } StateAutoMoveToPos.Instance.pos = autopoint; StateAutoMoveToPos.Instance.stopdistance = 2.0f; SelfRole.fsm.ChangeState(StateAutoMoveToPos.Instance); return; } if (!PlayerModel.getInstance().havePet || (PlayerModel.getInstance().havePet&& PlayerModel.getInstance().last_time == 0)) { SelfRole.fsm.ChangeState(StatePick.Instance); } return; } //!--有怪物在视野,直接开始攻击 SelfRole._inst.m_LockRole = mon; SelfRole.fsm.ChangeState(StateAttack.Instance); }
private MonsterRole Add(MonsterRole monsterRole) { List <MonsterRole> allRoles = GetAll(); int id = allRoles.Count > 0 ? allRoles.Select(existingMonsterRole => existingMonsterRole.Id).Max() + 1 : 0; MonsterRole newRole = new MonsterRole(id, monsterRole.Name, monsterRole.RuneSets, monsterRole.HpPercentWeight, monsterRole.AtkPercentWeight, monsterRole.DefPercentWeight, monsterRole.ExpectedBaseHp, monsterRole.ExpectedBaseAtk, monsterRole.ExpectedBaseDef, monsterRole.SpdWeight, monsterRole.CritRateWeight, monsterRole.CritDmgWeight, monsterRole.ResistanceWeight, monsterRole.AccuracyWeight); allRoles.Add(newRole); WriteRoles(allRoles); return(newRole); }
void onMonsterRemoved(GameEvent e) { MonsterRole m = (MonsterRole)e.orgdata; if (targetId == 0 || targetId == m.monsterid) { curNum++; if (curNum >= maxNum) { doit(); remove(this); } } }
public override void Execute(float delta_time) { this.thinktm += delta_time; bool flag = this.thinktm < 0.25f; if (!flag) { this.thinktm = 0f; bool isOutOfAutoPlayRange = this.isOutOfAutoPlayRange; if (isOutOfAutoPlayRange) { StateAutoMoveToPos.Instance.pos = StateInit.Instance.Origin; StateAutoMoveToPos.Instance.stopdistance = 0.3f; SelfRole.fsm.ChangeState(StateAutoMoveToPos.Instance); SelfRole._inst.m_LockRole = null; } else { Vector3 position = SelfRole._inst.m_curModel.position; MonsterRole monsterRole = MonsterMgr._inst.FindNearestMonster(position, null, false, PK_TYPE.PK_PEACE, this.onTaskMonsterSearch); bool flag2 = monsterRole == null; if (flag2) { Vector3 vector; bool flag3 = this.FindRandomPropAutoPoint(position, out vector); bool flag4 = flag3 && Vector2.Distance(new Vector2(StateInit.Instance.Origin.x, StateInit.Instance.Origin.z), new Vector2(vector.x, vector.z)) < StateInit.Instance.Distance; if (flag4) { bool flag5 = Vector3.Distance(vector, position) <= 2f; if (!flag5) { StateAutoMoveToPos.Instance.pos = vector; StateAutoMoveToPos.Instance.stopdistance = 2f; SelfRole.fsm.ChangeState(StateAutoMoveToPos.Instance); } } else { SelfRole.fsm.ChangeState(StatePick.Instance); } } else { SelfRole._inst.m_LockRole = monsterRole; SelfRole.fsm.ChangeState(StateAttack.Instance); } } } }
private decimal CalculateCurrentScore(Rune rune, MonsterRole role) { decimal score = 0; score += rune.PrimaryStat.Amount * role.GetWeight(rune.PrimaryStat.Type); if (rune.PrefixStat != null) { score += rune.PrefixStat.Amount * role.GetWeight(rune.PrefixStat.Type); } foreach (RuneStat stat in rune.Substats) { score += stat.Amount * role.GetWeight(stat.Type); } return(score); }
public MonsterRole getMonster(uint iid) { MonsterRole serverMonster = this.getServerMonster(iid); bool flag = serverMonster != null; MonsterRole result; if (flag) { result = serverMonster; } else { result = this.getFakeMonster(iid); } return(result); }
public Vector3 FindNearestMonsterPos(Vector3 me) { MonsterRole monsterRole = this.FindNearestMonster(me, null, false, PK_TYPE.PK_PEACE, false); bool flag = monsterRole != null; Vector3 result; if (flag) { result = monsterRole.m_curPhy.position; } else { result = Vector3.zero; } return(result); }
private void onMonsterRemoved(GameEvent e) { MonsterRole monsterRole = (MonsterRole)e.orgdata; bool flag = this.targetId == 0 || this.targetId == monsterRole.monsterid; if (flag) { this.curNum++; bool flag2 = this.curNum >= this.maxNum; if (flag2) { this.doit(); GameEventTrigger.remove(this); } } }
public void move(Variant msgData) { uint @uint = msgData["iid"]._uint; ProfessionRole otherPlayer = OtherPlayerMgr._inst.GetOtherPlayer(@uint); bool flag = otherPlayer != null; if (flag) { float x = msgData["to_x"]._float / 53.333f; float z = msgData["to_y"]._float / 53.333f; Vector3 vector = new Vector3(x, otherPlayer.m_curModel.position.y, z); bool flag2 = GameRoomMgr.getInstance().curRoom == GameRoomMgr.getInstance().dRooms[3342u]; if (flag2) { otherPlayer.SetDestPos(vector); } else { NavMeshHit navMeshHit; NavMesh.SamplePosition(vector, out navMeshHit, 100f, otherPlayer.m_layer); otherPlayer.SetDestPos(navMeshHit.position); } } else { float x2 = msgData["to_x"]._float / 53.333f; float z2 = msgData["to_y"]._float / 53.333f; MonsterRole serverMonster = MonsterMgr._inst.getServerMonster(@uint); bool flag3 = serverMonster != null; if (flag3) { Vector3 vector2 = new Vector3(x2, serverMonster.m_curModel.position.y, z2); bool flag4 = GameRoomMgr.getInstance().curRoom == GameRoomMgr.getInstance().dRooms[3342u]; if (flag4) { serverMonster.SetDestPos(vector2); } else { NavMeshHit navMeshHit2; NavMesh.SamplePosition(vector2, out navMeshHit2, 100f, serverMonster.m_layer); serverMonster.SetDestPos(navMeshHit2.position); } } } }
public List <GameplayAbility> GetMonsterAbilities(MonsterRole Role) { switch (Role) { case MonsterRole.BlobManA: return(BlobManA.StartingAbilities); case MonsterRole.BlobManB: return(BlobManB.StartingAbilities); case MonsterRole.CultistA: return(CultistA.StartingAbilities); case MonsterRole.CultistB: return(CultistB.StartingAbilities); case MonsterRole.CultistC: return(CultistC.StartingAbilities); } Debug.Assert(false, "Bad role"); return(new List <GameplayAbility>()); }
public List <AttributeEntry> GetMonsterStartingAttributes(MonsterRole Role) { switch (Role) { case MonsterRole.BlobManA: return(BlobManA.StartingAttributeSet); case MonsterRole.BlobManB: return(BlobManB.StartingAttributeSet); case MonsterRole.CultistA: return(CultistA.StartingAttributeSet); case MonsterRole.CultistB: return(CultistB.StartingAttributeSet); case MonsterRole.CultistC: return(CultistC.StartingAttributeSet); } Debug.Assert(false, "Bad role"); return(new List <AttributeEntry>()); }
private void on_monster_enter_zone(Variant msgData) { debug.Log("++++++++++++++++++++++++++monster+" + msgData.dump()); foreach (Variant current in msgData["monsters"]._arr) { bool flag = current.ContainsKey("carr"); if (flag) { MonsterMgr._inst.AddMonster_PVP(current); } else { bool flag2 = current.ContainsKey("owner_cid"); if (flag2) { MonsterMgr._inst.AddSummon(current); } else { bool flag3 = current.ContainsKey("owner_name"); if (flag3) { string text = current["owner_name"]; bool flag4 = BaseProxy <TeamProxy> .getInstance().MyTeamData == null && !ModelBase <PlayerModel> .getInstance().name.Equals(text); if (flag4) { MonsterRole monsterRole = MonsterMgr._inst.AddMonster(current, false); } else { bool flag5 = BaseProxy <TeamProxy> .getInstance().MyTeamData != null && !BaseProxy <TeamProxy> .getInstance().MyTeamData.IsInMyTeam(text); if (flag5) { MonsterRole monsterRole = MonsterMgr._inst.AddMonster(current, false); } else { MonsterRole monsterRole = MonsterMgr._inst.AddMonster(current, true); } } } else { MonsterRole monsterRole = MonsterMgr._inst.AddMonster(current, true); } } } bool flag6 = current.ContainsKey("escort_name"); if (flag6) { bool flag7 = ModelBase <PlayerModel> .getInstance().up_lvl >= 1u; if (flag7) { MonsterMgr._inst.AddDartCar(current); } else { MonsterMgr._inst.RemoveMonster(current["iid"]); } } } }
virtual public void onMonsterDied(MonsterRole monster) { }
public void onAttchange(Variant msgData) { debug.Log("onAttchange::" + msgData.dump()); BaseRole role = this.getRole(msgData["iid"]); bool flag = role == null; if (!flag) { bool isMain = role.m_isMain; bool flag2 = msgData.ContainsKey("hpchange"); if (flag2) { Variant variant = msgData["hpchange"]; int num = variant["hpchange"]; int num2 = variant["hp_left"]; Variant variant2 = new Variant(); bool flag3 = isMain; if (flag3) { ModelBase <PlayerModel> .getInstance().modHp(num2); } bool flag4 = num > 0; if (flag4) { role.modHp(num2); bool flag5 = isMain; if (flag5) { FightText.play(FightText.HEAL_TEXT, role.getHeadPos(), num, false, -1); } bool flag6 = this.healEff == null; if (flag6) { this.healEff = Resources.Load <GameObject>("FX/comFX/fuwenFX/FX_fuwen_chuyong"); } bool flag7 = this.healEff != null && role is ProfessionRole; if (flag7) { GameObject gameObject = UnityEngine.Object.Instantiate <GameObject>(this.healEff); UnityEngine.Object.Destroy(gameObject, 1f); gameObject.transform.SetParent(role.m_curModel, false); } bool flag8 = msgData.ContainsKey("rune_ids"); if (flag8) { List <Variant> arr = msgData["rune_ids"]._arr; foreach (Variant current in arr) { FightText.play(FightText.ADD_IMG_TEXT, role.getHeadPos(), num, false, current); } } } else { bool flag9 = num < 0; if (flag9) { uint iid = variant["frm_iid"]; BaseRole role2 = RoleMgr._instance.getRole(iid); Variant variant3 = msgData["rune_ids"]; int isCrit = variant3[0]; bool flag10 = msgData.ContainsKey("rune_ids"); if (flag10) { List <Variant> arr2 = msgData["rune_ids"]._arr; foreach (Variant current2 in arr2) { role.onServerHurt(-num, num2, variant["die"], role2, isCrit, false, false); } } } } } bool flag11 = msgData.ContainsKey("mpchange"); if (flag11) { Variant variant4 = msgData["mpchange"]; int num3 = variant4["mpchange"]; int mprest = variant4["mp_left"]; bool flag12 = isMain; if (flag12) { ModelBase <PlayerModel> .getInstance().modMp(mprest); } } bool flag13 = msgData.ContainsKey("pk_state"); if (flag13) { switch (msgData["pk_state"]) { case 0: role.m_ePK_Type = PK_TYPE.PK_PEACE; break; case 1: role.m_ePK_Type = PK_TYPE.PK_PKALL; break; case 2: role.m_ePK_Type = PK_TYPE.PK_TEAM; break; case 3: role.m_ePK_Type = PK_TYPE.PK_LEGION; break; case 4: role.m_ePK_Type = PK_TYPE.PK_HERO; break; } } bool flag14 = msgData.ContainsKey("clanid"); if (flag14) { role.m_unLegionID = msgData["clanid"]; } bool flag15 = msgData.ContainsKey("teamid"); if (flag15) { role.m_unTeamID = msgData["teamid"]; } bool flag16 = msgData.ContainsKey("rune_ids"); if (flag16) { List <Variant> arr3 = msgData["rune_ids"]._arr; foreach (Variant current3 in arr3) { GameObject runeEff = EffMgr.getRuneEff(current3._int); bool flag17 = runeEff != null; if (flag17) { GameObject gameObject2 = UnityEngine.Object.Instantiate <GameObject>(runeEff); UnityEngine.Object.Destroy(gameObject2, 2f); gameObject2.transform.SetParent(role.m_curModel, false); } } } bool flag18 = msgData.ContainsKey("sprite_flag"); if (flag18) { uint num4 = msgData["sprite_flag"]; uint iid2 = msgData["iid"]; MonsterRole monster = MonsterMgr._inst.getMonster(iid2); bool flag19 = monster != null; if (flag19) { SkinnedMeshRenderer component = monster.m_curModel.FindChild("body").GetComponent <SkinnedMeshRenderer>(); uint num5 = num4; if (num5 != 0u) { if (num5 == 1u) { component.sharedMaterial = Resources.Load <Material>("default/monster_1021_heite_gold"); } } else { Material[] sharedMaterials = component.sharedMaterials; for (int i = 0; i < sharedMaterials.Length; i++) { Material material = sharedMaterials[i]; material.shader = Shader.Find("A3/A3_Char_Streamer_H"); material.SetColor("_RimColor", new Color(0f, 0f, 0f, 0f)); material.SetFloat("_RimWidth", 0f); } } } } } }
//Does this role trade? public static bool tradingRole(MonsterRole role) { switch(role) { case MonsterRole.NULL: case MonsterRole.BROTHER: return false; case MonsterRole.BANKER: case MonsterRole.CHEF: case MonsterRole.HANDYMAN: return true; } return false; }
public async Task <MonsterRole> UpdateAsync(MonsterRole monsterRole) { return(await Task.Run(() => Update(monsterRole))); }
public void move(Variant msgData) { //RoleMgr._instance.onMove(msgData); uint iid = msgData["iid"]._uint; ProfessionRole pr = OtherPlayerMgr._inst.GetOtherPlayer(iid); if (a3_insideui_fb.instance != null && PlayerModel.getInstance().inFb) { a3_insideui_fb.instance.Cancel(); } if (pr != null) { float to_x = msgData["to_x"]._float / GameConstant.PIXEL_TRANS_UNITYPOS; float to_y = msgData["to_y"]._float / GameConstant.PIXEL_TRANS_UNITYPOS; Vector3 vec = new Vector3(to_x, pr.m_curModel.position.y, to_y); if (GameRoomMgr.getInstance().curRoom == GameRoomMgr.getInstance().dRooms[3342]) {//解决多层阻挡点寻路的问题 pr.SetDestPos(vec); } else { NavMeshHit hit; NavMesh.SamplePosition(vec, out hit, 100f, pr.m_layer); pr.SetDestPos(hit.position); } } else { float to_x = msgData["to_x"]._float / GameConstant.PIXEL_TRANS_UNITYPOS; float to_y = msgData["to_y"]._float / GameConstant.PIXEL_TRANS_UNITYPOS; MonsterRole role = MonsterMgr._inst.getServerMonster(iid); if (role != null) { Vector3 vec = new Vector3(to_x, role.m_curModel.position.y, to_y); if (GameRoomMgr.getInstance().curRoom == GameRoomMgr.getInstance().dRooms[3342] || GameRoomMgr.getInstance().curRoom == GameRoomMgr.getInstance().dRooms[3358]) {//解决多层阻挡点寻路的问题 role.SetDestPos(vec); } else { NavMeshHit hit; NavMesh.SamplePosition(vec, out hit, 100f, role.m_layer); role.SetDestPos(hit.position); } } } //LGAvatarGameInst to = getRoleByIID(data["iid"]); //if (to == null) return; //to.addMoving(data); //Variant moveinfo = new Variant(); //if (data == null || !data.ContainsKey("to_x")) //{ // GameTools.PrintError("addMoving err!"); // return; //} ////debug.Log("收到移动消息 " + data.dump()); //float to_x = data["to_x"]._float / GameConstant.PIXEL_TRANS_UNITYPOS; //float to_y = data["to_y"]._float / GameConstant.PIXEL_TRANS_UNITYPOS; //debug.Log("收到移动消息 " + to_x + " " + to_y); ////setMoveInfo(moveinfo); }
public async Task <MonsterRole> AddAsync(MonsterRole monsterRole) { return(await Task.Run(() => Add(monsterRole))); }
static public void FrameMove(float fdt) { List <uint> need_del = new List <uint>(); foreach (OneFollowBlt p in m_mapFollowBullet.Values) { try { float t = p.costtime / p.maxtime; p.costtime += fdt; if (t > 1f) { if (p.aniTrack != null) { p.aniTrack.speed = 0; } if (p.aniFx != null) { p.aniFx.SetTrigger(EnumAni.ANI_T_FXDEAD); } GameObject.Destroy(p.blt_hd.m_hdRootObj, 1f); need_del.Add(p.id); if (p.locker is MonsterRole) { MonsterRole mr = p.locker as MonsterRole; if (mr.isfake) { mr.onHurt(p.blt_hd); } else { //如果是主角,请求服务器 if (p.blt_hd.m_CastRole == SelfRole._inst) { List <uint> list_hitted = new List <uint>(); list_hitted.Add(mr.m_unIID); int lockid = -1; if (SelfRole._inst.m_LockRole != null && SelfRole._inst.m_LockRole.m_unIID == mr.m_unIID) { lockid = (int)SelfRole._inst.m_LockRole.m_unIID; } BattleProxy.getInstance().sendcast_target_skill(p.blt_hd.m_unSkillID, list_hitted, 0, lockid); list_hitted = null; } } } } else { Vector3 t_pos = p.locker.m_curModel.position; t_pos.y += 1.5f; Vector3 pos = p.beginpos + (t_pos - p.beginpos) * t; p.blt_hd.m_hdRootObj.transform.position = pos; } } catch (System.Exception ex) { need_del.Add(p.id); break; } } for (int i = 0; i < need_del.Count; i++) { m_mapFollowBullet.Remove(need_del[i]); } }
public static void FrameMove(float fdt) { List <uint> list = new List <uint>(); foreach (OneFollowBlt current in FollowBullet_Mgr.m_mapFollowBullet.Values) { try { float num = current.costtime / current.maxtime; current.costtime += fdt; bool flag = num > 1f; if (flag) { bool flag2 = current.aniTrack != null; if (flag2) { current.aniTrack.speed = 0f; } bool flag3 = current.aniFx != null; if (flag3) { current.aniFx.SetTrigger(EnumAni.ANI_T_FXDEAD); } UnityEngine.Object.Destroy(current.blt_hd.m_hdRootObj, 1f); list.Add(current.id); bool flag4 = current.locker is MonsterRole; if (flag4) { MonsterRole monsterRole = current.locker as MonsterRole; bool isfake = monsterRole.isfake; if (isfake) { monsterRole.onHurt(current.blt_hd); } else { bool flag5 = current.blt_hd.m_CastRole == SelfRole._inst; if (flag5) { List <uint> list2 = new List <uint>(); list2.Add(monsterRole.m_unIID); int lockid = -1; bool flag6 = SelfRole._inst.m_LockRole != null && SelfRole._inst.m_LockRole.m_unIID == monsterRole.m_unIID; if (flag6) { lockid = (int)SelfRole._inst.m_LockRole.m_unIID; } BaseProxy <BattleProxy> .getInstance().sendcast_target_skill(current.blt_hd.m_unSkillID, list2, 0, lockid); } } } } else { Vector3 position = current.locker.m_curModel.position; position.y += 1.5f; Vector3 position2 = current.beginpos + (position - current.beginpos) * num; current.blt_hd.m_hdRootObj.transform.position = position2; } } catch (Exception var_16_1FB) { list.Add(current.id); break; } } for (int i = 0; i < list.Count; i++) { FollowBullet_Mgr.m_mapFollowBullet.Remove(list[i]); } }