示例#1
0
 /// <summary>
 /// Usunięcie planety z układu słonecznego
 /// </summary>
 private void PlanetMenuDeleteButtonClick()
 {
     PlanetManager.Destroy(PlanetData.SelectedPlanet);
     MenuSwitcher.Switch(MenuState.Free);
     CameraFocus.Unfocus();
     RefreshSelectPlanetDropdown();
 }
示例#2
0
    public static void Load(string saveName)
    {
        if (!File.Exists(saveName + ".txt"))
        {
            return;
        }

        //Czyszczenie układu z planet
        while (PlanetData.Planets.Count != 0)
        {
            PlanetManager.Destroy(PlanetData.Planets[0]);
        }

        using (StreamReader sr = new StreamReader(saveName + ".txt"))
        {
            while (!sr.EndOfStream)
            {
                IMovingPlanet planet = PlanetManager.Create();
                planet.PlanetName  = sr.ReadLine();
                planet.Size        = float.Parse(sr.ReadLine());
                planet.Mass        = float.Parse(sr.ReadLine());
                planet.Speed       = float.Parse(sr.ReadLine());
                planet.SunDistance = float.Parse(sr.ReadLine());
                planet.Material    = sr.ReadLine();
            }
        }

        Factory.GetUIController().RefreshSelectPlanetDropdown();
    }
示例#3
0
 void OnTriggerExit(Collider c)
 {
     if ("Player".Equals(c.tag))
     {
         PlanetManager.Over();
     }
 }
示例#4
0
 private void Start()
 {
     main             = this.transform.GetChild(2).gameObject;
     Atmoshpere.color = new Color(Atmoshpere.color.r, Atmoshpere.color.g, Atmoshpere.color.b, 0f);
     planetManager    = FindObjectOfType <PlanetManager>();
     done             = false;
 }
示例#5
0
    void Start()
    {
        planetManager = GetComponent <PlanetManager>();
        gameConfig    = GameManager.instance.gameConfig;

        chooseStrategyRandomly();
    }
        public static void Postfix(global::Planetbase.GuiMenuSystem __instance)
        {
            var buttonIcon = TypeList <ModuleType, ModuleTypeList> .find(typeof(ModuleTypeStorage).Name).getIcon();

            //Create the new button
            var pauseMenuItem = new GuiMenuItem(
                buttonIcon,
                StringList.get("menu_deliver"),
                parameter =>
            {
                if (DeliveriesMod.ActiveDeliveryShip)
                {
                    return;
                }

                DeliveriesMod.ActiveDeliveryShip = true;

                var startPosition = ((GameStateGame)GameManager.getInstance().mGameState).findStartPosition();

                DeliveriesMod.Ship = global::Planetbase.ColonyShip.create(
                    startPosition + Vector3.up * 100f,
                    startPosition,
                    PlanetManager.getCurrentPlanet().getStartingResources()
                    );
            }
                );

            //Add the new button to the main GUI menu and reorder it
            var mainMenu = __instance.mMenuMain;

            mainMenu.mItems.Remove(__instance.mItemHelp);
            mainMenu.addItem(pauseMenuItem);
            mainMenu.addItem(__instance.mItemHelp);
        }
示例#7
0
    protected override void Awake()
    {
        base.Awake();

        _rigidBody     = GetComponent <Rigidbody>();
        _planetManager = PlanetManager.Instance;
        SetPlanet();
    }
示例#8
0
 private void Awake()
 {
     manager        = Transform.FindObjectOfType <PlanetManager>();
     spRenderer     = GetComponent <SpriteRenderer>();
     planetCollider = GetComponent <Collider2D>();
     defaultScale   = transform.localScale.x;
     hp             = maxHP;
 }
示例#9
0
 // Update is called once per frame
 void Update()
 {
     if (PlanetManager.GetState() == 2)
     {
         transform.position = camera_pos2
                              + calcPos(Player.transform.position, (new Vector3(1, 1, 0)));
     }
 }
        /// <summary>
        /// Sets up all Blueprint Property Floats, Colors, and Materials for Gas Planet Blueprints.
        /// Reset() is called when component is added and if Inspector > Cog wheel > Reset is clicked in the Editor.
        /// </summary>
        void Reset()
        {
            // Ensure there is a parent
            if (transform.parent == null)
            {
                Debug.LogError("There is no parent object to this blueprint. This game object must be a child to a gameobject with the Manager component. Aborting.");
                return;
            }

            // Get a reference to the Manager
            PlanetManager _manager = transform.parent.GetComponent <PlanetManager>();

            // Ensure the parent has the Manager component
            if (_manager == null)
            {
                Debug.LogError("The parent of this game object must have the Manager component. Aborting.");
                return;
            }

            // Add the blueprint Property Floats, Colors, and Materials
            AddBlueprintPropertyMaterial("gas", "Gas", PlanetManager.Instance.gasMaterials.ToArray());
            AddBlueprintPropertyColor("twilightColor", "Twilight Color", new Color(0.15f, 0.0f, 0.15f, 1.0f), 0.05f, 0.05f, 0.05f);

            AddBlueprintPropertyFloat("gasSeed", "Gas Seed", 0, 255, false, true);
            AddBlueprintPropertyFloat("turbulenceSeed", "Turbulence Seed", 0, 255, false, true);
            AddBlueprintPropertyFloat("horizontalTiling", "Horizontal Tiling", 1, 10, false, true);
            AddBlueprintPropertyFloat("verticalTiling", "Vertical Tiling", 1, 10, false, true);

            AddBlueprintPropertyFloat("turbulence", "Turbulence", 0.0f, 1.0f, true, false);
            AddBlueprintPropertyFloat("turbulenceScale", "Turbulence Scale", 0.0f, 1.0f, true, false);
            AddBlueprintPropertyFloat("turbulenceDisorder", "Turbulence Disorder", 0.0f, 1.0f, true, false);
            AddBlueprintPropertyFloat("smoothness", "Smoothness", 0.0f, 1.0f, true, false);
            AddBlueprintPropertyFloat("blurriness", "Blurrinenss", 0.0f, 1.0f, true, false);
            AddBlueprintPropertyFloat("separation", "Separation", 0.0f, 1.0f, true, false);
            AddBlueprintPropertyFloat("palette", "Palette", 1, 8, false, true);
            AddBlueprintPropertyFloat("detail", "Detail", 0.0f, 1.0f, true, false);
            AddBlueprintPropertyFloat("detailOffset", "Detail Offset", 0.0f, 1.0f, true, false);
            AddBlueprintPropertyFloat("contrast", "Contrast", 0.0f, 1.0f, true, false);
            AddBlueprintPropertyFloat("hue", "Hue", 0.0f, 1.0f, true, false);
            AddBlueprintPropertyFloat("saturation", "Saturation", 0.0f, 1.0f, true, false);
            AddBlueprintPropertyFloat("brightness", "Brightness", 0.0f, 1.0f, true, false);
            AddBlueprintPropertyFloat("banding", "Banding", 0.0f, 1.0f, true, false);
            AddBlueprintPropertyFloat("solidness", "Solidness", 0.0f, 1.0f, true, false);
            AddBlueprintPropertyFloat("faintness", "Faintness", 0.0f, 1.0f, true, false);
            AddBlueprintPropertyColor("faintnessColor", "Faintness Color", new Color(0.5f, 0.5f, 0.5f, 1.0f), 0.2f, 0.2f, 0.2f);
            AddBlueprintPropertyFloat("roughness", "Roughness", 0.0f, 1.0f, true, false);
            AddBlueprintPropertyFloat("stormMaskIndex", "Storm Mask Index", 0.0f, 1.0f, true, false);
            AddBlueprintPropertyFloat("stormSquash", "Storm Squash", 0.0f, 1.0f, true, false);
            AddBlueprintPropertyColor("stormColor", "Storm Color", new Color(0.78f, 0.13f, 0.28f, 1.0f), 0.05f, 0.05f, 0.05f);
            AddBlueprintPropertyFloat("stormTint", "Storm Tint", 0.0f, 1.0f, true, false);
            AddBlueprintPropertyFloat("stormScale", "Storm Scale", 0.0f, 1.0f, true, false);
            AddBlueprintPropertyFloat("stormNoise", "Storm Noise", 0.0f, 1.0f, true, false);
            AddBlueprintPropertyColor("atmosphereColor", "Atmosphere Color", new Color(0.48f, 0.48f, 0.3f, 1.0f), 0.05f, 0.05f, 0.05f);
            AddBlueprintPropertyFloat("atmosphereFalloff", "Atmosphere Falloff", 1.0f, 20.0f, true, false);

            // Refresh the lists of blueprints in the Manager
            _manager.RefreshLists();
        }
示例#11
0
 // Start is called before the first frame update
 void Start()
 {
     shipController = FindObjectOfType <ShipController>();
     finalObject    = GameObject.FindGameObjectWithTag("final_object");
     scoreTracker   = FindObjectOfType <ScoreTracker>();
     planetManager  = FindObjectOfType <PlanetManager>();
     gameManager    = FindObjectOfType <GameManager>();
     winScreen      = FindObjectOfType <WinScreenUI>();
 }
示例#12
0
    protected override void Awake()
    {
        base.Awake();

        _name          = "Planète Twippie";
        _planetManager = PlanetManager.Instance;
        _planetManager.Add(this);
        _vertexManager  = GetComponent <VertexManager>();
        _twippieManager = TwippieManager.Instance;
    }
        public void EquatorialCoordinates_Success(DateTime date, string planetName, Vector2 <decimal> expected, decimal epsilon = 0.05m)
        {
            // arrange & act
            var actual = PlanetManager.GetInstance()
                         .GetPlanet(planetName)
                         .EquatorialCoordinates(date);

            // assert
            Assert.True(Vector2 <decimal> .IsClose(actual, expected, epsilon), $"actual {actual}, expected:{expected}");
        }
示例#14
0
    void Awake()
    {
        mainCam       = Camera.main;
        backdrop      = mainCam.GetComponent <CameraBehaviour>();
        asteroids     = GetComponent <AsteroidManager>();
        planetManager = GetComponent <PlanetManager>();

        systemData = LoadSystemData("Sol");
        _minimapManager.GenerateSystemMap();
    }
示例#15
0
 public void Awake()
 {
     instance = this;
     GameEnded.AddListener(Die);
     _earthSprite = _earth.earthSprite;
     _moonSprite  = _earth.moonSprite;
     _deathSprite = _earth.destroyedSprite;
     eventAddScore.AddListener(AddScore);
     glitchScore = PlayerPrefs.GetInt("glitch", 11);
 }
示例#16
0
 void Awake()
 {
     toolManager   = GetComponent <ToolManager>();
     planetManager = GetComponent <PlanetManager>();
     enemyManager  = GetComponent <EnemyManager>();
     playerManager = GetComponent <PlayerManager>();
     planetManager.StvoriPlanet(4, planetManager.planet_list, planetManager.enemyPlanet);
     enemyManager.SpawnEnemy();
     toolManager.StvoriAlat();
     playerManager.StvoriIgraca(playerManager.player);
 }
示例#17
0
        public void EclipticSun3D_Success(DateTime date, Vector3 <decimal> expected)
        {
            // arrange
            var earth = PlanetManager.GetInstance().GetPlanet("Earth");

            // act
            var actual = earth.EclipticSun3D(date);

            //assert
            Assert.True(Vector3 <decimal> .IsClose(actual, expected, 0.001m), $"actual: {actual}, expected: {expected}, distance: {Vector3<decimal>.Distance(actual, expected)}");
        }
    void Start()
    {
        planetManager                  = new PlanetManager();
        planetManager.MenuCamera       = GameObject.Find("Startmenu Camera");
        planetManager.ParentGameObject = GameObject.Find("StartMenu");

        if (ApplicationModel.Instance.IsCurrentlyPlaying())
        {
            this.MenuScreen();
        }
    }
    void OnEnable()
    {
        if (instance != null)
        {
            Destroy(gameObject);
            return;
        }
        instance = this;

        InvokeRepeating(nameof(Tick), tickTime, tickTime);
    }
        public void EclipticSun3D_Success(DateTime date, string planetName, Vector3 <decimal> expected, decimal epsilon = 0.001m)
        {
            //arrange
            var planet = PlanetManager.GetInstance().GetPlanet(planetName);

            // act
            var actual = planet.EclipticSun3D(date);

            // assert
            Assert.True(Vector3 <decimal> .IsClose(actual, expected, epsilon), $"actual {actual}, expected:{expected}, distance: {Vector3<decimal>.Distance(actual, expected)}");
        }
        public void ApparentEclipticEarth_Success(DateTime date, string planetName, Vector2 <decimal> expected, decimal epsilon = 0.1m)
        {
            // arrange
            var planet = PlanetManager.GetInstance().GetPlanet(planetName);

            // act
            var actual = planet.ApparentEclipticEarth(date);

            // assert
            Assert.True(Vector2 <decimal> .IsClose(actual, expected, epsilon), $"actual {actual}, expected:{expected}");
        }
示例#22
0
    void Awake()
    {
        if (!_instance)
        {
            _instance = this;
        }

        else
        {
            Destroy(gameObject);
        }
    }
示例#23
0
        public static void Initialize()
        {
            FactoryManager.Initialize();
            PlanetManager.Initialize();
            Initialized = true;
            ExitingMultiplayerSession = false;

            using (GetRemotePlayersModels(out var remotePlayersModels))
            {
                remotePlayersModels.Clear();
            }
        }
 /// Raises Exception if multiple singleton instances are present at once
 private void Awake()
 {
     if (_instance != null && _instance != this)
     {
         throw new System.Exception("Multiple PlanetManager instances are present. There should only be one instance of a Singleton.");
     }
     else
     {
         _instance = this;
     }
     planets = new List <Planet>();
 }
示例#25
0
    // Use this for initialization
    void Start()
    {
        planetManager = Transform.FindObjectOfType <PlanetManager>();
        planetManager.SetResourceCounter(this);

        for (int i = 0; i < hudEntries.Count; ++i)
        {
            ResourceHUDEntry entry = hudEntries[i];
            entry.text.text  = string.Format("{0:00000}", planetManager.GetResourceType(entry.type));
            entry.img.sprite = planetManager.GetIconForResourceType(entry.type);
        }
    }
示例#26
0
    // player gains money and fame for selling scrap
    public void SellScrap()
    {
        PlanetManager planetManager = GameObject.Find("StatRetriever").GetComponent <PlanetManager>();

        if (scrapToSell > 0 && scrapToSell <= planetManager.scrap)
        {
            planetManager.scrap      -= scrapToSell;
            planetManager.money      += (int)(scrapToSell * buyPrice);
            planetManager.playerFame += scrapToSell / 500f;
        }
        PlayerPrefs.SetFloat("Scrap", planetManager.scrap);
        PlayerPrefs.SetFloat("Money", planetManager.money);
    }
示例#27
0
 private void Awake()
 {
     // Déclaration du singleton
     if (instance != null && instance != this)
     {
         Destroy(this.gameObject);
         return;
     }
     else
     {
         instance = this;
     }
 }
示例#28
0
 // Start is called before the first frame update
 private void Start()
 {
     // Set up the singleton
     if (Instance == null)
     {
         Instance = this;
         DontDestroyOnLoad(gameObject);
     }
     else
     {
         // If there is already an instance, then just destroy whatever this is
         Debug.LogWarning("There is more than one PlanetManager in the scene");
         Destroy(gameObject);
     }
 }
示例#29
0
    void OnTriggerEnter(Collider other)
    {
        Debug.Log("OnTriggerEnter");
        spawnPoint = other.gameObject.GetComponent <Transform>().position;
        Debug.Log(spawnPoint);

        PlanetManager script = pmObj.GetComponent <PlanetManager>();

        script.planetChange(spawnPoint);

        GameManager.Instance().exploreUi.SetActive(true);
        other.gameObject.SetActive(false);

        Time.timeScale = 0;
    }
示例#30
0
    /// <summary>
    /// Creates a planet based on a previously exported Base64 encoded JSON string (exported via the inspector of a planet in the Unity editor).
    /// </summary>
    public void CreatePlanetUsingBase64EncodedJSON()
    {
        // If a planet already exists in the scene, destroy it
        if (_planet != null)
        {
            DestroyImmediate(_planet.gameObject);
        }

        // Use PlanetManager.CreatePlanet method to create a new planet and include the Base64 JSON string as a second argument to force all properties.
        _planet = PlanetManager.CreatePlanet(Vector3.zero, "eyJjYXRlZ29yeSI6InBsYW5ldCIsInR5cGUiOiJTb2xpZFBsYW5ldCIsInZlcnNpb24iOiIwLjEuMiIsInBsYW5ldCI6eyJwbGFuZXRTZWVkIjo3NTQzODA2OTcsInZhcmlhdGlvblNlZWQiOjAsImJsdWVwcmludEluZGV4IjowLCJibHVlcHJpbnROYW1lIjoiVGVycmVzdHJpYWwiLCJwcm9wZXJ0eUZsb2F0cyI6eyJhbGllbml6YXRpb24iOjAsImNvbnRpbmVudFNlZWQiOjk0LCJjb250aW5lbnRTaXplIjowLjc4NTMyODEsImNvbnRpbmVudENvbXBsZXhpdHkiOjAuMzExNjc2MiwiY29hc3RhbERldGFpbCI6MC4yNDYwMzg3LCJjb2FzdGFsUmVhY2giOjAuNDkyNTEyNCwibGlxdWlkTGV2ZWwiOjAuNTYyLCJsaXF1aWRPcGFjaXR5IjoxLCJsaXF1a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yIjowLjE1NTMxNzUsImciOjAuNzQ0Njc4MywiYiI6MX0sInR3aWxpZ2h0Q29sb3IiOnsiciI6MC4zODU0NjQsImciOjAuMzE5NjA4NCwiYiI6MC4wODcwNTUzOX0sImNsb3Vkc0NvbG9yIjp7InIiOjEsImciOjEsImIiOjF9LCJsYXZhR2xvd0NvbG9yIjp7InIiOjAuOTY3ODU2OCwiZyI6MC4wNDA3OTc4OSwiYiI6MC4wMTY5NDQxMX0sImNpdGllc0NvbG9yIjp7InIiOjAuOTMzMDU1OCwiZyI6MC45MjQxNzkxLCJiIjowLjYzNTQzM319fX0=");
        _planet.AddListener(gameObject);

        // Set the UI text message to indicate that textures are being rebuilt.
        uiTextMessage.text = "Rebuilding textures...";
    }
示例#31
0
    public void SetLevelSettings(LevelSettingsEditor settings)
    {
        _planets = new PlanetManager();
        _planets.Initialize(settings);

        _bounds = new Bounds(settings.Bounds.position, settings.Bounds.size);
        _startPosition = settings.StartPosition;
        _gravity = settings.Gravity;
        _rotationAcceleration = settings.RotationAcceleration;
        _equilibriumSpeed = settings.EquilibriumSpeed;
        _orbitAccelerationTime = settings.OrbitAccelerationTime;
    }
	void Awake ()
	{
		_instance = this;

		float scaleRp = Scales.au2mu;

		//eccentricity, r_pericenter, orbital period, radius, axial tilt, rot period, longtitude of ascending node, mass
		const int numOfPlanetParams = 8;
		planetParameters [0] = new float[numOfPlanetParams] {
			0.2056f,
			0.3075f * scaleRp,
			0.241f,
			0.38f,
			0.01f,
			-0.16f   ,
			48.3f,
			0.05527f
		};		//Mercury
		planetParameters [1] = new float[numOfPlanetParams] {
			0.0067f,
			0.718f * scaleRp,
			0.615f,
			0.95f,
			177.4f,
			-0.67f  ,
			76.7f,
			0.8145f
		};		//Venus
		planetParameters [2] = new float[numOfPlanetParams] {
			0.0167f,
			0.9833f * scaleRp,
			1f,
			1f,
			23.45f,
			-0.0027f,
			349f,
			1f
		};	        //Earth
		planetParameters [3] = new float[numOfPlanetParams] {
			0.0934f,
			1.3814f * scaleRp,
			1.882f,
			0.53f,
			25.19f,
			-0.0029f,
			49.6f,
			0.1075f
		};		    //Mars
		planetParameters [4] = new float[numOfPlanetParams] {
			0.0488f,
			4.950f * scaleRp,
			11.86f ,
			11f,
			3.13f,
			-0.0011f ,
			101f,
			317.828f
		};		//Jupiter
		planetParameters [5] = new float[numOfPlanetParams] {
			0.0542f,
			9.021f * scaleRp,
			29.457f ,
			9.14f,
			26.73f,
			-0.0012f,
			114f,
			95.161f
		};		//Saturn
		planetParameters [6] = new float[numOfPlanetParams] {
			0.0472f,
			18.286f * scaleRp,
			84.016f ,
			4f,
			97.77f,
			0.0019f,
			74.2f,
			14.5357f
		};	    //Uranus
		planetParameters [7] = new float[numOfPlanetParams] {
			0.0086f,
			29.81f * scaleRp,
			164.791f,
			3.9f,
			28.32f,
			-0.0018f,
			131f,
			17.1478f
		};		//Neptune

		const int numOfMoonParams = 8;
		moonParameters [0] = new float[numOfMoonParams] {
			0.055f,
			2.44f,
			0.074f,
			0.273f,
			6.69f,
			-29 / 365f,
			0.0f,
			0.012f
		};	

		for (int i = 0; i < planetNames.Length; i++)
			CreatePlanet (planetNames [i], Resources.Load (planetMaterials [i]) as Material, planetParameters [i]);

		for (int i = 0; i < moonNames.Length; i++)
			CreateMoon (moonNames [i], moonParentNames [i], Resources.Load (moonMaterials [i]) as Material, moonParameters [i]);

		rings = Instantiate (Resources.Load ("Prefabs/Rings") as GameObject) as GameObject;
		rings.transform.parent = Planet.planetList [5].transform.FindChild (meshChildPrefix + "Saturn");
		rings.transform.localScale = new Vector3 (5, 5, 5);
	}