Пример #1
0
    public static PlanetSystem GetRandomPlanetSystem(int numberPlanet, Star motherStar)
    {
        Planet       planet       = PlanetCreator.CreatePlanet(numberPlanet, motherStar);
        PlanetSystem planetSystem = new PlanetSystem
        {
            planet     = planet,
            moonsArray = MoonCreator.CreateMoonsArray(planet),
        };

        return(planetSystem);
    }
Пример #2
0
    public void addPlanetToCollection(Formation planet)
    {
        int    planetIndex = 0;
        string name        = planet.name;

        for (int i = 0; i < maxNumPlanet; i++)
        {
            if (collectionBook[i].tag.Equals(name))
            {
                planetIndex = i;
                Debug.Log("planet index: " + i);
                break;
            }
        }

        if (planet.name != "fail" && !collection.Contains(name))
        {
            numPlanetColelcted++;
            collection.Add(name);
            planetsNotInCollection.Remove(name);

            Debug.Log(name + " is added to the collection");

            // get all UI compoents of the newly collected planet
            GameObject planetObj   = collectionBook[planetIndex];
            GameObject planetImage = planetObj.transform.GetChild(0).gameObject;
            GameObject planetName  = planetObj.transform.GetChild(1).gameObject;

            // update the image of the planet on UI
            Sprite image = Resources.Load <Sprite> (planet.name + "_2D") as Sprite;
            planetImage.GetComponent <Image>().sprite = image;

            // update the name of the planet on UI
            planetName.GetComponent <Text>().text = name.ToUpper();

            foreach (string collected in collection)
            {
                Debug.Log("in collection: " + collected);
            }
        }

        if (numPlanetColelcted == maxNumPlanet)
        {
            PlanetCreator planetCreator = UnityEngine.GameObject.FindGameObjectWithTag("creator").GetComponent <PlanetCreator>();
            planetCreator.restartPane.SetActive(false);
            planetCreator.solarSystemPane.SetActive(true);
            StartCoroutine(WaitToPlayCompletionVoice());
        }
    }
Пример #3
0
    void Awake()
    {
        // create instance
        if (instance == null)
        {
            instance = this;
        }
        else if (instance != this)
        {
            Destroy(gameObject);
        }


        //planets = new GameObject[10];
        ingredients = new HashSet <string> {
            "nitrogen", "hydrogen", "oxygen", "sulfur", "carbon"
        };
        userMixture = new HashSet <string>();

        HashSet <string> mercuryIngredients = new HashSet <string> {
            "oxygen", "hydrogen", "nitrogen"
        };
        HashSet <string> venusIngredients = new HashSet <string> {
            "carbon", "hydrogen", "sulfur"
        };
        HashSet <string> earthIngredients = new HashSet <string> {
            "nitrogen", "carbon", "hydrogen"
        };
        HashSet <string> marsIngredients = new HashSet <string> {
            "nitrogen", "carbon", "oxygen"
        };
        HashSet <string> jupiterIngredients = new HashSet <string> {
            "nitrogen", "hydrogen", "sulfur"
        };
        HashSet <string> saturnIngredients = new HashSet <string> {
            "oxygen", "hydrogen", "sulfur"
        };
        HashSet <string> uranusIngredients = new HashSet <string> {
            "carbon", "oxygen", "hydrogen"
        };
        HashSet <string> neptuneIngredients = new HashSet <string> {
            "carbon", "oxygen", "sulfur"
        };
        HashSet <string> plutoIngredients = new HashSet <string> {
            "nitrogen", "carbon", "sulfur"
        };
        HashSet <string> failIngredients = new HashSet <string> {
            "nitrogen", "oxygen", "sulfur"
        };

        Formation mercury = new Formation("mercury", mercuryIngredients, Resources.Load("mercury") as GameObject, Resources.Load("PlanetsVoiceOver/MercuryVoice") as AudioClip);
        Formation venus   = new Formation("venus", venusIngredients, Resources.Load("venus") as GameObject, Resources.Load("PlanetsVoiceOver/VenusVoice") as AudioClip);
        Formation earth   = new Formation("earth", earthIngredients, Resources.Load("earth") as GameObject, Resources.Load("PlanetsVoiceOver/EarthVoice") as AudioClip);
        Formation mars    = new Formation("mars", marsIngredients, Resources.Load("mars") as GameObject, Resources.Load("PlanetsVoiceOver/MarsVoice") as AudioClip);
        Formation jupiter = new Formation("jupiter", jupiterIngredients, Resources.Load("jupiter") as GameObject, Resources.Load("PlanetsVoiceOver/JupiterVoice") as AudioClip);
        Formation saturn  = new Formation("saturn", saturnIngredients, Resources.Load("saturn") as GameObject, Resources.Load("PlanetsVoiceOver/SaturnVoice") as AudioClip);
        Formation uranus  = new Formation("uranus", uranusIngredients, Resources.Load("uranus") as GameObject, Resources.Load("PlanetsVoiceOver/UranusVoice") as AudioClip);
        Formation neptune = new Formation("neptune", neptuneIngredients, Resources.Load("neptune") as GameObject, Resources.Load("PlanetsVoiceOver/NeptuneVoice") as AudioClip);
        Formation pluto   = new Formation("pluto", plutoIngredients, Resources.Load("pluto") as GameObject, Resources.Load("PlanetsVoiceOver/PlutoVoice") as AudioClip);
        Formation fail    = new Formation("fail", failIngredients, Resources.Load("fail") as GameObject, Resources.Load("PlanetsVoiceOver/FailVoice") as AudioClip);

        results[0] = mercury;
        results[1] = venus;
        results[2] = earth;
        results[3] = mars;
        results[4] = jupiter;
        results[5] = saturn;
        results[6] = uranus;
        results[7] = neptune;
        results[8] = pluto;
        results[9] = fail;

        foreach (GameObject image in asteroidTracking)
        {
            image.GetComponent <Image> ().enabled = false;
        }

        protoPlanet.GetComponent <Animator> ().enabled = false;
        GameObject bigAsteroids = UnityEngine.GameObject.FindGameObjectWithTag("bigAsteroids");

        bigAsteroids.gameObject.GetComponent <Animator> ().enabled = false;

        SoundManager.instance.playBackgroundSound("backgroundSound", backgroundSound);

        // reloads collection book for each planet creator instance
        collectionBook = UnityEngine.GameObject.FindGameObjectWithTag("Collection").GetComponent <PlanetCollection>();
        collectionBook.ReloadCollectionBook();
        if (!collectionBook.isTutorialShown)
        {
            SoundManager.instance.playSingle("voiceOverSource", beginningOfExperienceVoiceOver);
        }
    }
Пример #4
0
 // Use this for initialization
 void Start()
 {
     create = FindObjectOfType <PlanetCreator>();
 }