void RPC_S2C_TownAreaList(uLink.BitStream stream, uLink.NetworkMessageInfo info) { Vector3[] townArea = stream.Read <Vector3[]> (); if (ForceSetting.Instance.Conflict(Id, mainPlayerId)) { return; } foreach (Vector3 townPos in townArea) { IntVector2 center = new IntVector2(Mathf.RoundToInt(townPos.x), Mathf.RoundToInt(townPos.z)); if (VArtifactTownManager.Instance.TownPosInfo.ContainsKey(center)) { VArtifactTown ti = VArtifactTownManager.Instance.TownPosInfo [center]; //int id = ti.townId; if (VArtifactTownManager.Instance.IsCaptured(ti.townId)) { RandomMapIconMgr.AddDestroyedTownIcon(ti); } else { RandomMapIconMgr.AddTownIcon(ti); DetectedTownMgr.Instance.AddDetectedTown(ti); } foreach (VArtifactUnit vau in ti.VAUnits) { vau.isDoodadNpcRendered = true; } ti.IsExplored = true; VArtifactTownManager.Instance.DetectTowns(ti); } } }
void RPC_S2C_AddTownArea(uLink.BitStream stream, uLink.NetworkMessageInfo info) { Vector3 townPos = stream.Read <Vector3> (); if (LogFilter.logDebug) { Debug.LogFormat("<color=blue>Add town pos:{0}</color>", townPos); } if (ForceSetting.Instance.Conflict(Id, mainPlayerId)) { return; } IntVector2 center = new IntVector2(Mathf.RoundToInt(townPos.x), Mathf.RoundToInt(townPos.z)); if (VArtifactTownManager.Instance.TownPosInfo.ContainsKey(center)) { VArtifactTown ti = VArtifactTownManager.Instance.TownPosInfo [center]; //int id = ti.townId; DetectedTownMgr.Instance.AddDetectedTown(ti); RandomMapIconMgr.AddTownIcon(ti); foreach (VArtifactUnit vau in ti.VAUnits) { vau.isDoodadNpcRendered = true; } ti.IsExplored = true; VArtifactTownManager.Instance.DetectTowns(ti); } }
//public static bool IsInBuildingArea(Vector2 pos, List<VArtifactUnit> vauList) //{ // bool flag = false; // foreach(VArtifactUnit vau in vauList) // { // foreach (BuildingID bid in vau.buildingPosID.Values) // { // Quaternion q = new Quaternion(); // q.eulerAngles = new Vector3(0, -vab.rotation, 0); // Vector3 pointPos = new Vector3(pos.x, vab.root.y, pos.y); // Vector3 relativePos = q * (pointPos - vab.root); // if (relativePos.x > -vab.size.x / 2 && relativePos.x < vab.size.x / 2 // && relativePos.z > -vab.size.y && relativePos.z < vab.size.y / 2) // { // flag = true; // break; // } // } // if (flag) // break; // } // return flag; //} #region Town public static void ShowAllTowns() { List <VArtifactTown> vatList = VArtifactTownManager.Instance.townPosInfo.Values.ToList(); foreach (VArtifactTown vat in vatList) { if (vat.Type == VArtifactType.NpcTown) { RandomMapIconMgr.AddTownIcon(vat); } else { RandomMapIconMgr.AddNativeIcon(vat); } } }