private Double3 GetOffset() { CelestialBodyData.Type type = this.following.GetFollowingBody().type; if (type == CelestialBodyData.Type.Star) { return(new Double3(this.mapPosition.roundTo1000.x, this.mapPosition.roundTo1000.y, this.mapPosition.z)); } if (type == CelestialBodyData.Type.Planet) { return(this.following.GetFollowingBody().GetPosOut(Ref.controller.globalTime) / 10000.0); } if (type != CelestialBodyData.Type.Moon) { return(Double3.zero); } return((this.following.GetFollowingBody().GetPosOut(Ref.controller.globalTime) + this.following.GetFollowingBody().parentBody.GetPosOut(Ref.controller.globalTime)) / 10000.0); }
private LineRenderer CreatePlanetOrbitLine(Transform parent, double radius, string name, int orbitLineResolution, CelestialBodyData.Type bodyType) { Transform transform = UnityEngine.Object.Instantiate <Transform>(this.planetOrbitLinePrefab, Vector3.zero, Quaternion.identity, parent); transform.GetComponent <Ellipse>().resolution = orbitLineResolution; transform.name = name + " Orbit line"; transform.localPosition = Vector3.zero; transform.localScale = Vector3.one * (float)(radius / 10000.0); transform.GetComponent <LineRenderer>().sortingOrder = 0; transform.GetComponent <LineRenderer>().sortingLayerName = "Map"; transform.GetComponent <LineRenderer>().startColor = new Color(1f, 1f, 1f, 0.12f); transform.GetComponent <LineRenderer>().endColor = new Color(1f, 1f, 1f, 0.025f); transform.GetComponent <LineRenderer>().material = ((bodyType != CelestialBodyData.Type.Planet) ? this.orbitLineMaterials[CelestialBodyData.Type.Planet] : this.orbitLineMaterials[CelestialBodyData.Type.Star]); return(transform.GetComponent <LineRenderer>()); }