public Satellite(string name, Vector3 position, float radius, Material material, float spinSpeed, Planet planet) : base(name) { this.radius = radius; this.sphere = new Sphere(name, position, radius, Constants.satelliteLongitudeSegments, Constants.satelliteLatitudeSegments, material); this.sphere.gameObject.AddComponent <Spin>().speed = spinSpeed; Orbit orbit = this.sphere.gameObject.AddComponent <Orbit>(); orbit.center = planet.sphere.gameObject; float distance = Vector3.Distance(sphere.gameObject.transform.position, planet.sphere.gameObject.transform.position); orbit.speed = Constants.satelliteOrbitConstant / distance; sphere.gameObject.transform.SetParent(planet.sphere.gameObject.transform); SimpleHoverInfo simpleHoverInfo = this.sphere.gameObject.AddComponent <SimpleHoverInfo>(); simpleHoverInfo.bodyRadius = radius; DetailedView detailedView = this.sphere.gameObject.AddComponent <DetailedView>(); detailedView.bodyRadius = radius; }
public Star(string name, Vector3 position, float radius, Material material) : base(name) { this.radius = radius; this.sphere = new Sphere(name, position, radius, Constants.starLongitudeSegments, Constants.starLatitudeSegments, material); GameObject light = new GameObject(name + "Light"); light.transform.position = sphere.gameObject.transform.position; Light l = light.AddComponent <Light>(); l.type = LightType.Point; //TODO: set range and intensity based on size and strength l.range = 1000; l.intensity = 1; SimpleHoverInfo simpleHoverInfo = this.sphere.gameObject.AddComponent <SimpleHoverInfo>(); simpleHoverInfo.bodyRadius = radius; DetailedView detailedView = this.sphere.gameObject.AddComponent <DetailedView>(); detailedView.bodyRadius = radius; }