Exemple #1
0
    /// <summary>
    /// Zapisanie właściwości planety
    /// </summary>
    private void PlanetMenuSaveButtonClick()
    {
        PlanetData.SelectedPlanet.PlanetName = PlanetNameChecker.Check(PlanetMenuNameInput.text);
        PlanetData.SelectedPlanet.Mass       = PlanetMenuMassSlider.value;
        PlanetData.SelectedPlanet.Speed      = PlanetMenuSpeedSlider.value;
        PlanetPositioner.ResetRotation(PlanetData.SelectedPlanet);

        MenuSwitcher.Switch(MenuState.Distance);
        CameraFocus.OnPlanetsView();
    }
    public static IMovingPlanet Create()
    {
        var planetPrefab = GameObject.Instantiate(Resources.Load("Prefabs/Planet")) as GameObject;
        //var planetPrefab = UnityEditor.PrefabUtility.InstantiatePrefab(Resources.Load("Prefabs/Planet")) as GameObject;
        var planet = planetPrefab.GetComponent <Planet>();

        planet.PlanetName  = PlanetNameChecker.Check("Planet");
        planet.SunDistance = 220f;
        planet.Size        = 1f;
        planet.Material    = "Blue";
        PlanetData.AddPlanet(planet);
        return(planet);
    }