Example #1
0
    public PlanetMaker(Vector3 solarSysCenter, float orbit)
    {
        //INIT
        this.planetSettings = GameObject.Find("SpaceMaker").GetComponent <CommonSettings>().planetSettings;
        Vector3 seedPosition = solarSysCenter * orbit * CommonSettings.smallNoiseScale;

        seed = ((int)(seedPosition.x)) | (((int)(seedPosition.y)) << 8) | (((int)(seedPosition.z)) << 16);
        //Debug.Log(seed);
        noise = new NoiseFilter(seed);
        Vector3 position = solarSysCenter + Vector3.left * orbit;

        this.radius = planetSettings.minRadius + noise.newValueFromCoords(position) * planetSettings.radiusMultiplier;
        this.orbit  = orbit;
        this.speed  = noise.newValueFromCoords(position) * planetSettings.speedMultiplier;
        //MAKING
        GameObject planet = new GameObject("Planet");

        initialize(planet);
        generateMesh();

        planet.transform.position   = solarSysCenter + Vector3.left * this.orbit;
        planet.transform.localScale = Vector3.one * radius;

        planet.AddComponent(typeof(PlanetBehavior));
        planet.GetComponent <PlanetBehavior>().center = solarSysCenter;
        planet.GetComponent <PlanetBehavior>().radius = this.orbit;
        planet.GetComponent <PlanetBehavior>().speed  = speed;
    }
Example #2
0
 public SunMaker(Vector3 center)
 {
     //INIT
     sunSettings = GameObject.Find("SpaceMaker").GetComponent <CommonSettings>().sunSettings;
     seed        = ((int)center.x) | (((int)center.y) << 8) | (((int)center.z) << 16);
     noise       = new NoiseFilter(seed);
     this.center = center;
     this.radius = sunSettings.minRadius + noise.newValueFromCoords(this.center) * sunSettings.radiusMultiplier;
     //MAKING
     makeSphere(this.center, radius);
 }
Example #3
0
    private void makePlanets()
    {
        float planetAmount = solarSystemSettings.minPlanets + (int)((solarSystemSettings.maxPlanets - solarSystemSettings.minPlanets) * noise.newValueFromCoords(center));
        float orbit        = solarSystemSettings.sunMargin;

        for (int i = 0; i < planetAmount; i++)
        {
            orbit = solarSystemSettings.minSpacing + noise.newValueFromCoords(center);
            PlanetMaker pm = new PlanetMaker(center, orbit);
        }
    }