public Vector3 GetRandomPatrolPoint() { Vector3 vector3 = Vector3.zero; MonumentInfo randomValidMonumentInfo = null; if (TerrainMeta.Path != null && TerrainMeta.Path.Monuments != null && TerrainMeta.Path.Monuments.Count > 0) { int count = TerrainMeta.Path.Monuments.Count; int num = UnityEngine.Random.Range(0, count); for (int i = 0; i < count; i++) { int num1 = i + num; if (num1 >= count) { num1 -= count; } MonumentInfo item = TerrainMeta.Path.Monuments[num1]; if (item.Type != MonumentType.Cave && item.Type != MonumentType.WaterWell && item.Tier != MonumentTier.Tier0 && (int)(item.Tier & MonumentTier.Tier0) <= 0) { bool flag = false; foreach (Vector3 visitedPoint in this.visitedPoints) { if (Vector3Ex.Distance2D(item.transform.position, visitedPoint) >= 100f) { continue; } flag = true; goto Label0; } Label0: if (!flag) { randomValidMonumentInfo = item; break; } } } if (randomValidMonumentInfo == null) { this.visitedPoints.Clear(); randomValidMonumentInfo = this.GetRandomValidMonumentInfo(); } } if (randomValidMonumentInfo == null) { float size = TerrainMeta.Size.x; float single = 30f; vector3 = Vector3Ex.Range(-1f, 1f); vector3.y = 0f; vector3.Normalize(); vector3 = vector3 * (size * UnityEngine.Random.Range(0f, 0.75f)); vector3.y = single; } else { this.visitedPoints.Add(randomValidMonumentInfo.transform.position); vector3 = randomValidMonumentInfo.transform.position; } return(vector3); }
public Vector3 GetRandomPatrolDestination() { RaycastHit raycastHit; Vector3 height = Vector3.zero; if (!(TerrainMeta.Path != null) || TerrainMeta.Path.Monuments == null || TerrainMeta.Path.Monuments.Count <= 0) { float size = TerrainMeta.Size.x; float single = 30f; height = Vector3Ex.Range(-1f, 1f); height.y = 0f; height.Normalize(); height = height * (size * UnityEngine.Random.Range(0f, 0.75f)); height.y = single; } else { MonumentInfo item = null; if (this._visitedMonuments.Count > 0) { foreach (MonumentInfo monument in TerrainMeta.Path.Monuments) { bool flag = false; foreach (MonumentInfo _visitedMonument in this._visitedMonuments) { if (monument != _visitedMonument) { continue; } flag = true; } if (flag) { continue; } item = monument; goto Label0; } } Label0: if (item == null) { this._visitedMonuments.Clear(); item = TerrainMeta.Path.Monuments[UnityEngine.Random.Range(0, TerrainMeta.Path.Monuments.Count)]; } if (item) { height = item.transform.position; this._visitedMonuments.Add(item); height.y = TerrainMeta.HeightMap.GetHeight(height) + 200f; if (TransformUtil.GetGroundInfo(height, out raycastHit, 300f, 1235288065, null)) { height.y = raycastHit.point.y; } height.y += 30f; } } return(height); }
protected override void Awake() { base.Awake(); Monument = base.transform.GetComponentInParent <MonumentInfo>(); if ((bool)TerrainMeta.Path) { TerrainMeta.Path.DungeonEntrances.Add(this); } }
void OnServerInitialized() { Outpost = UnityEngine.Object.FindObjectsOfType <MonumentInfo>().First(monument => monument.Type == MonumentType.Town); if (Outpost == null) { MissionUtility.LogError("Could not find outpost!"); } }
public static MapMarker ForMonument(MonumentInfo monument) { string iconUrl = GetIconForMonument(monument); return(new MapMarker { IconUrl = iconUrl, Label = (iconUrl == Ui.MapIcon.Unknown) ? monument.name : null, X = TranslatePosition(monument.transform.position.x), Z = TranslatePosition(monument.transform.position.z) }); }
float?GetMonumentZoneRadius(MonumentInfo monument) { if (monument.Type == MonumentType.Cave) { return(null); } foreach (var entry in Instance.Options.Zones.MonumentZones) { if (monument.name.ToLowerInvariant().Contains(entry.Key)) { return(entry.Value); } } return(null); }
public MonumentInfo GetRandomValidMonumentInfo() { int count = TerrainMeta.Path.Monuments.Count; int num = Random.Range(0, count); for (int index1 = 0; index1 < count; ++index1) { int index2 = index1 + num; if (index2 >= count) { index2 -= count; } MonumentInfo monument = TerrainMeta.Path.Monuments[index2]; if (monument.Type != MonumentType.Cave && monument.Type != MonumentType.WaterWell && monument.Tier != MonumentTier.Tier0) { return(monument); } } return((MonumentInfo)null); }
private MonumentInfo GetRandomValidMonumentInfo() { int count = TerrainMeta.Path.Monuments.Count; int num = Random.Range(0, count); for (int i = 0; i < count; i++) { int num2 = i + num; if (num2 >= count) { num2 -= count; } MonumentInfo monumentInfo = TerrainMeta.Path.Monuments[num2]; if (monumentInfo.Type != 0 && monumentInfo.Type != MonumentType.WaterWell && monumentInfo.Tier != MonumentTier.Tier0) { return(monumentInfo); } } return(null); }
public MonumentInfo GetRandomValidMonumentInfo() { int count = TerrainMeta.Path.Monuments.Count; int num = UnityEngine.Random.Range(0, count); for (int i = 0; i < count; i++) { int num1 = i + num; if (num1 >= count) { num1 -= count; } MonumentInfo item = TerrainMeta.Path.Monuments[num1]; if (item.Type != MonumentType.Cave && item.Type != MonumentType.WaterWell && item.Tier != MonumentTier.Tier0) { return(item); } } return(null); }
private static MonumentInfo FindClosest(Vector3 point, MonumentInfo[] monumentInfos) { MonumentInfo monument = null; var distance = 9999f; foreach (var monumentInfo in monumentInfos) { if (!monumentInfo.gameObject.activeInHierarchy) { continue; } var curDistance = Vector3.Distance(point, monumentInfo.transform.position); if (!(curDistance < distance)) { continue; } distance = curDistance; monument = monumentInfo; } return(monument); }
public void Setup(MonumentInfo info) { string str = info.displayPhrase.translated; this.text.text = (string.IsNullOrEmpty(str) ? "Monument" : str); }
static string GetIconForMonument(MonumentInfo monument) { if (monument.Type == MonumentType.Cave) { return(Ui.MapIcon.Cave); } if (monument.name.Contains("airfield")) { return(Ui.MapIcon.Airfield); } if (monument.name.Contains("bandit_town")) { return(Ui.MapIcon.BanditTown); } if (monument.name.Contains("compound")) { return(Ui.MapIcon.Compound); } if (monument.name.Contains("sphere_tank")) { return(Ui.MapIcon.Dome); } if (monument.name.Contains("harbor")) { return(Ui.MapIcon.Harbor); } if (monument.name.Contains("gas_station")) { return(Ui.MapIcon.GasStation); } if (monument.name.Contains("junkyard")) { return(Ui.MapIcon.Junkyard); } if (monument.name.Contains("launch_site")) { return(Ui.MapIcon.LaunchSite); } if (monument.name.Contains("lighthouse")) { return(Ui.MapIcon.Lighthouse); } if (monument.name.Contains("military_tunnel")) { return(Ui.MapIcon.MilitaryTunnel); } if (monument.name.Contains("warehouse")) { return(Ui.MapIcon.MiningOutpost); } if (monument.name.Contains("powerplant")) { return(Ui.MapIcon.PowerPlant); } if (monument.name.Contains("quarry")) { return(Ui.MapIcon.Quarry); } if (monument.name.Contains("satellite_dish")) { return(Ui.MapIcon.SatelliteDish); } if (monument.name.Contains("radtown_small_3")) { return(Ui.MapIcon.SewerBranch); } if (monument.name.Contains("power_sub")) { return(Ui.MapIcon.Substation); } if (monument.name.Contains("supermarket")) { return(Ui.MapIcon.Supermarket); } if (monument.name.Contains("trainyard")) { return(Ui.MapIcon.Trainyard); } if (monument.name.Contains("water_treatment_plant")) { return(Ui.MapIcon.WaterTreatmentPlant); } return(Ui.MapIcon.Unknown); }
public void Setup(MonumentInfo info) { string translated = info.displayPhrase.translated; this.text.set_text(string.IsNullOrEmpty(translated) ? "Monument" : translated); }
public Vector3 GetRandomPatrolPoint() { Vector3.get_zero(); MonumentInfo monumentInfo = (MonumentInfo)null; if (Object.op_Inequality((Object)TerrainMeta.Path, (Object)null) && TerrainMeta.Path.Monuments != null && TerrainMeta.Path.Monuments.Count > 0) { int count = TerrainMeta.Path.Monuments.Count; int num = Random.Range(0, count); for (int index1 = 0; index1 < count; ++index1) { int index2 = index1 + num; if (index2 >= count) { index2 -= count; } MonumentInfo monument = TerrainMeta.Path.Monuments[index2]; if (monument.Type != MonumentType.Cave && monument.Type != MonumentType.WaterWell && (monument.Tier != MonumentTier.Tier0 && (monument.Tier & MonumentTier.Tier0) <= (MonumentTier)0)) { bool flag = false; using (List <Vector3> .Enumerator enumerator = this.visitedPoints.GetEnumerator()) { while (enumerator.MoveNext()) { Vector3 current = enumerator.Current; if ((double)Vector3Ex.Distance2D(((Component)monument).get_transform().get_position(), current) < 100.0) { flag = true; break; } } } if (!flag) { monumentInfo = monument; break; } } } if (Object.op_Equality((Object)monumentInfo, (Object)null)) { this.visitedPoints.Clear(); monumentInfo = this.GetRandomValidMonumentInfo(); } } Vector3 vector3_1; if (Object.op_Inequality((Object)monumentInfo, (Object)null)) { this.visitedPoints.Add(((Component)monumentInfo).get_transform().get_position()); vector3_1 = ((Component)monumentInfo).get_transform().get_position(); } else { float x = (float)TerrainMeta.Size.x; float num = 30f; Vector3 vector3_2 = Vector3Ex.Range(-1f, 1f); vector3_2.y = (__Null)0.0; ((Vector3) ref vector3_2).Normalize(); vector3_1 = Vector3.op_Multiply(vector3_2, x * Random.Range(0.0f, 0.75f)); vector3_1.y = (__Null)(double)num; } return(vector3_1); }
private void DrawMonument(MonumentInfo monument) { //TODO }
public override Vector3 GetRandomPatrolPoint() { Vector3 vector = Vector3.zero; MonumentInfo monumentInfo = null; if (TerrainMeta.Path != null && TerrainMeta.Path.Monuments != null && TerrainMeta.Path.Monuments.Count > 0) { int count = TerrainMeta.Path.Monuments.Count; int num = Random.Range(0, count); for (int i = 0; i < count; i++) { int num2 = i + num; if (num2 >= count) { num2 -= count; } MonumentInfo monumentInfo2 = TerrainMeta.Path.Monuments[num2]; if (monumentInfo2.Type == MonumentType.Cave || monumentInfo2.Type == MonumentType.WaterWell || monumentInfo2.Tier == MonumentTier.Tier0 || (monumentInfo2.Tier & MonumentTier.Tier0) > (MonumentTier)0) { continue; } bool flag = false; foreach (Vector3 visitedPatrolPoint in visitedPatrolPoints) { if (Vector3Ex.Distance2D(monumentInfo2.transform.position, visitedPatrolPoint) < 100f) { flag = true; break; } } if (!flag) { monumentInfo = monumentInfo2; break; } } if (monumentInfo == null) { visitedPatrolPoints.Clear(); monumentInfo = GetRandomValidMonumentInfo(); } } if (monumentInfo != null) { visitedPatrolPoints.Add(monumentInfo.transform.position); vector = monumentInfo.transform.position; } else { float x = TerrainMeta.Size.x; float y = 30f; vector = Vector3Ex.Range(-1f, 1f); vector.y = 0f; vector.Normalize(); vector *= x * Random.Range(0f, 0.75f); vector.y = y; } float num3 = Mathf.Max(TerrainMeta.WaterMap.GetHeight(vector), TerrainMeta.HeightMap.GetHeight(vector)); float num4 = num3; RaycastHit hitInfo; if (Physics.SphereCast(vector + new Vector3(0f, 200f, 0f), 20f, Vector3.down, out hitInfo, 300f, 1218511105)) { num4 = Mathf.Max(hitInfo.point.y, num3); } vector.y = num4 + 30f; return(vector); }