void Start()
    {
        foreach (Image x in hillTimers)
        {
            x.color = new Color(255, 255, 255, 0f);
        }
        parameterSetByName = GameObject.FindObjectOfType <ParameterSetByName>();
        DontDestroyOnLoad(this);
        keepScore = FindObjectOfType <KeepScore>();
        Debug.Log(keepScore);
        winner             = "hi";
        hillCollection     = hills.GetComponentsInChildren <Transform>();
        timePassed_seconds = 1.0f;

        hillCollection = ConstructHillArray(hillCollection);
        foreach (Transform element in hillCollection)
        {
            element.gameObject.SetActive(false);
        }
        index      = Random.Range(0, hillCollection.Length);
        activeHill = hillCollection[index];
        activeHill.gameObject.SetActive(true);
        activatedHills.Add(index);
        changeTimerColor(activeHill);

        crystalSpawners  = GameObject.FindGameObjectsWithTag("crystalSpawner");
        desertSpawners   = GameObject.FindGameObjectsWithTag("desertSpawner");
        tropicalSpawners = GameObject.FindGameObjectsWithTag("tropicalSpawner");
        bisonSpawn       = crystalSpawners[0].GetComponent <BisonSpawn>();

        int totalBison = bisonCount * 2 * (crystalSpawners.Length + desertSpawners.Length + tropicalSpawners.Length);

        bisonNames = new string[totalBison];
        bisonNames = GenerateNames(totalBison);
        for (int k = 0; k < bisonNames.Length; k++)
        {
            //Debug.Log("bisonNames: " + bisonNames[k]);
            //Debug.Log("bisonNames: " + bisonNames[k]);
        }
        determineSpawnLocation(bisonCount, 0);
        parameterSetByName.TimeGet(gameTime_seconds, activeHill);
        refreshed = false;
        // Start time marker
        timeMarker.GetComponent <Transform>().DOLocalRotate(new Vector3(0f, 0f, 0f), 360f, RotateMode.Fast).SetEase(Ease.Linear);
    }
Beispiel #2
0
    //Awake is always called before any Start functions
    void Awake()
    {
        timerText       = GameObject.Find("TimeText").GetComponent <Text>();
        hills           = GameObject.Find("Hills");
        TimerBackground = GameObject.Find("CurrentBiome").GetComponent <Image>();
        timerColor      = GameObject.Find("BiomeIndicator").GetComponent <Image>();
        endText1        = GameObject.Find("Time");
        endText2        = GameObject.Find("Up");

        Debug.Log("online game manager awake");
        DontDestroyOnLoad(this);
        keepScore = FindObjectOfType <OnlineKeepScore>();
        Debug.Log(keepScore);
        winner             = "hi";
        hillCollection     = hills.GetComponentsInChildren <Transform>();
        timePassed_seconds = 1.0f;

        hillCollection = ConstructHillArray(hillCollection);
        foreach (Transform element in hillCollection)
        {
            element.gameObject.SetActive(false);
        }
        index      = Random.Range(0, hillCollection.Length);
        activeHill = hillCollection[index];
        activeHill.gameObject.SetActive(true);
        activatedHills.Add(index);
        timerAnimator = timerColor.GetComponent <Animator>();
        timerEnding   = TimerBackground.GetComponent <Animator>();
        changeTimerColor(activeHill);
        if (timerAnimator != null)
        {
            Debug.Log("animator found");
        }
        crystalSpawners  = GameObject.FindGameObjectsWithTag("crystalSpawner");
        desertSpawners   = GameObject.FindGameObjectsWithTag("desertSpawner");
        tropicalSpawners = GameObject.FindGameObjectsWithTag("tropicalSpawner");
        bisonSpawn       = crystalSpawners[0].GetComponent <BisonSpawn>();
    }