// Use this for initialization void Start() { //planet graphics SpriteCollection sc = GameObject.Find("Sprite Collection").GetComponent<SpriteCollection>(); ssc = transform.parent.GetComponent<SolarSystemGen>(); transform.position += new Vector3(orbitDistance, 0, 0); g = gameObject.AddComponent<SpriteRenderer>(); c = gameObject.AddComponent<CircleCollider2D>(); g.sprite = habitable ? sc.getHabitablePlanet() : sc.getHostilePlanet(); float scale = habitable ? Random.Range(0.2f, 0.5f): Random.Range(0.4f, 0.75f); transform.localScale = new Vector3(scale, scale, scale); planetInfo = new PlanetInfo(GetComponentInParent<SolarSystemGen>().starInfo.name + orbitDistance, habitable, GetComponentInParent<SolarSystemGen>().starInfo.rank); }
// Use this for initialization void Start() { //planet graphics SpriteCollection sc = GameObject.Find("Sprite Collection").GetComponent <SpriteCollection>(); ssc = transform.parent.GetComponent <SolarSystemGen>(); transform.position += new Vector3(orbitDistance, 0, 0); g = gameObject.AddComponent <SpriteRenderer>(); c = gameObject.AddComponent <CircleCollider2D>(); g.sprite = habitable ? sc.getHabitablePlanet() : sc.getHostilePlanet(); float scale = habitable ? Random.Range(0.2f, 0.5f): Random.Range(0.4f, 0.75f); transform.localScale = new Vector3(scale, scale, scale); planetInfo = new PlanetInfo(GetComponentInParent <SolarSystemGen>().starInfo.name + orbitDistance, habitable, GetComponentInParent <SolarSystemGen>().starInfo.rank); }