void Update() { if (!GameOver) { if (inRecycleBin != null) { if (!inRecycleBin.IsClickedOn) { inRecycleBin.HoverOverBin = false; iconPool.ReturnGameObjectToPool(inRecycleBin.gameObject); inRecycleBin = null; recycleSound.Play(); shakeGameObject(gameObject, 0.3f, 0.1f); score++; } } if ((float)iconPool.NumberOfActiveObjects / (float)iconPool.MaxNumberOfObjects > 0.85) { GameOver = true; resetPanel.SetActive(true); resetButton.Init(); if (!errorSoundPlayed) { errorPopUp.Play(); errorSoundPlayed = true; } } } }
void Start() { //currentPlanet = new Planet(); //currentPlanet.InitFromMiniGame(this.gm.generator.currentSystemName, this.gm.currentPlanet); //planetName.text = currentPlanet.planetName; data = new PlanetData(this.gm.currentPlanetType); this.displaySprite.SetSprite("display_" + this.gm.currentPlanetType.ToString()); switch (this.gm.currentPlanetType) { case PlanetTypeEnum.Desert: this.mineField.color = planetFields.Desert; break; case PlanetTypeEnum.Forest: this.mineField.color = planetFields.Forest; break; case PlanetTypeEnum.Clay: this.mineField.color = planetFields.Clay; break; case PlanetTypeEnum.Tundra: this.mineField.color = planetFields.Tundra; break; case PlanetTypeEnum.Icy: this.mineField.color = planetFields.Icy; break; case PlanetTypeEnum.Water: this.mineField.color = planetFields.Water; break; case PlanetTypeEnum.Plain: this.mineField.color = planetFields.Plain; break; } resetButton.Init(this); GenerateField(data.data.numOfDiamonds, data.data.numOfGolds, data.data.numOfSilvers, data.data.numOfBronzes); tryController.ResetTries(data.data.numOfTries); resetButton.Hide(); totalValue = 0; totalValueDisplay.text = "0"; }