public CelestialBody(SystemController controller, GameObject gameObject, int seed, CelestialType type, CelestialBody host = null) { if (host != null) { type = new CelestialType.Moon(type); } gameObject.name = type.ToString(); this.controller = controller; this.seed = seed; this.type = type; this.gameObject = gameObject; this.host = host; System.Random random = new System.Random(seed); radius = (int)Utility.GetRandomBetween(random, type.minRadius, type.maxRadius); density = type.density; orbitDistance = Utility.GetRandomBetween(random, type.minDistance, type.maxDistance); mass = (4.0 / 3.0) * Math.PI * Math.Pow(radius, 3.0) * density; oribtalVelocity = Utility.GetRandomBetween(random, 0.5, 3) / 360.0 * (type is CelestialType.Moon ? 100 : 1); orbitalOffset = Utility.GetRandomBetween(random, 0, 360); rotationAxis = Utility.RandomVector(random); rotationSpeed = Utility.GetRandomBetween(random, 50, 100); UpdatePositionInSystem(); }
public override string ToString() { return(originalType.ToString().Replace("Planet", "Moon")); }