// ---- METHODS ---- #region // Generate Planet public GameObject GeneratePlanet() { planet = new GameObject(name); planet.AddComponent <MeshFilter>(); planet.AddComponent <MeshRenderer>(); planet.AddComponent <MeshCollider>(); PlanetScript ps = planet.AddComponent <PlanetScript>(); // Add planet script PlanetScript planetScript = planet.GetComponent <PlanetScript>(); //planetScript.planetData = this; // <--------------------<----------------------<---------------------<------------------<-------- Jos käytät tätä scriptiä niin muista tää ------<------------------< if (hasAtmosphere) { atmosphere = AtmosphereGenerator.GenerateAtmosphere(planet.transform, planetSize / 2f + 15f, 0.25f); } return(planet); }
// ---- METHODS ---- #region // Generate Planet public GameObject GeneratePlanet(Vector3 position) { planet = new GameObject(name); planet.tag = "Planet"; planet.AddComponent <MeshFilter>(); planet.AddComponent <MeshRenderer>(); PlanetScript ps = planet.AddComponent <PlanetScript>(); ps.planetData = this; GravityAttractor ga = planet.AddComponent <GravityAttractor>(); if (hasAtmosphere) { atmosphere = AtmosphereGenerator.GenerateAtmosphere(planet.transform, planetSize / 2f, 0.1f); //atmosphere = AtmosphereGenerator.GenerateAtmosphere(planet.transform, planetSize / 2f + 12f, 0.1f); } planet.transform.position = position; return(planet); }
// Use this for initialization void Start() { planet = transform; atmosphere = AtmosphereGenerator.GenerateAtmosphere(planet, radius, 0.25f); }