private void Validate_Zone(ZoneProfile zone) { if (!Zones.Contains(zone)) { throw new BrandonException($"The {nameof(ZoneProfile)} {zone} is not in the {nameof(BenthicProfile)} {this}!"); } }
public Vector2 GetZoneGeographicAltitudeBoundaries(ZoneProfile zoneProfile) { var zoneStart = 0 - Zones.TakeWhile(it => it != zoneProfile).Sum(it => it.Amplitude); var zoneEnd = zoneStart - zoneProfile.Amplitude; return(new Vector2(zoneStart, zoneEnd)); }
public Vector2 GetZoneGeographicDistanceBoundaries(ZoneProfile zoneProfile) { var min = Zones.TakeWhile(it => it != zoneProfile).Sum(it => it.GeographicDistance); var max = min + zoneProfile.GeographicDistance; return(new Vector2(min, max)); }
public ZonePoint ZonePointOf(ZoneProfile zoneProfile, float zoneDist01, float zoneBreadth01) { return(new ZonePoint(CoastlineTerrain, BuildBenthicProfile(), zoneProfile) { Distance = zoneDist01, Breadth = zoneBreadth01 }); }
public void PlantFakeTree(ZoneProfile zoneProfile, GameObject tree, Spacey.IWorldly treePoint, float treeScale) { var treeRandomizedRotation = Quaternion.AngleAxis(Random.Range(0, 360), Vector3.up); var treeRot = TerrainCaster.SampleRotation(treePoint, CoastlineTerrain) * treeRandomizedRotation; var treeInstance = Instantiate(tree, treePoint.Worldly, treeRot, GetZoneTreeHolder(zoneProfile)); treeInstance.transform.localScale = Vector3.one * treeScale; }
/// <summary> /// goes from <see cref="DimensionSpace.Benthic"/> -> <see cref="DimensionSpace.Zone"/> /// </summary> /// <param name="geographicDistance"></param> /// <param name="zone"></param> /// <returns></returns> public float FindPointInZone(float geographicDistance, ZoneProfile zone) { Validate_GeographicDistance(geographicDistance); var zoneBounds = GetZoneGeographicDistanceBoundaries(zone); return(GetPortion(geographicDistance, zoneBounds)); }
private Holder GetZoneTreeHolder(ZoneProfile zoneProfile) { if (!ZoneTreeHolders.ContainsKey(zoneProfile)) { ZoneTreeHolders.Add(zoneProfile, new Holder(zoneProfile.ToString(), TreeHolder)); } return(ZoneTreeHolders[zoneProfile]); }
public ZoneProfile FindRelativeZone(ZoneProfile currentZone, int offset) { var zoneIndex = Zones.IndexOf(currentZone); var offsetIndex = zoneIndex + offset; if (offsetIndex < 0 || offsetIndex >= Zones.Count) { return(null); } return(Zones[offsetIndex]); }
public ZonePoint(Terrain worldTerrain, BenthicProfile benthicProfile, ZoneProfile zoneProfile) { this.WorldTerrain = worldTerrain; this.BenthicProfile = benthicProfile; this.ZoneProfile = zoneProfile; }
public void AddZone(ZoneProfile zoneProfile) { _zones.Add(zoneProfile); _zones.Sort(); }
private bool IsGeographicDistanceInZone(float geographicDistance, ZoneProfile zone) { return(IsPointInRange(geographicDistance, GetZoneGeographicDistanceBoundaries(zone))); }
private float ZoneHeightToGeographicAltitude(ZoneProfile zone, float heightInZone) { var altitudeBoundaries = Sorted(GetZoneGeographicAltitudeBoundaries(zone)); return(Mathf.Lerp(altitudeBoundaries.x, altitudeBoundaries.y, heightInZone)); }