示例#1
0
    /// <summary>
    /// Adds a planet to the solar system
    /// Create gameobject, sets up the orbit and generates texture
    /// </summary>
    public void AddSolarBody()
    {
        GameObject newBody = CreateSolarBodyObject();

        SolarBody newSolar = newBody.GetComponent <SolarBody>();

        float distanceFromSun = getLastPlanetDistance();

        newSolar.Setup(distanceFromSun, transform, BodyType.Earth, false);

        solarBodies.Add(newSolar);

        SetPlanetName(newBody, newSolar);

        ApplyTexture(newSolar);
    }
示例#2
0
    /// <summary>
    /// Adds a sattellite to the provided planet
    /// Creates a gameobject, sets up the orbit and generates texture
    /// </summary>
    /// <param name="parent"></param>
    public void AddSatellite(SolarBody parent)
    {
        GameObject newBody = CreateSolarBodyObject();

        SolarBody newSolar = newBody.GetComponent <SolarBody>();

        float distanceFromSun = getLastPlanetDistance();

        distanceFromSun += getSatelliteDistance(parent);

        newSolar.Setup(distanceFromSun, parent.transform, BodyType.Moon, true);

        parent.AddSatellite(newSolar);

        SetSatelliteName(newBody, newSolar, parent);

        ApplyTexture(newSolar);
    }