Пример #1
0
    // Use this for initialization
    void Start()
    {
        base.Start();
        villageNameText = GameObject.Find("SelectionText").GetComponent <Text>();

        //set up population

        poisoned = false;

        waterLevelText = GameObject.Find("WaterLevelText").GetComponent <Text> ();

        //find well
        GameObject wellObject = GameObject.FindWithTag("Well");

        wellScript = wellObject.GetComponent <WellScript> ();

        waterLevel = maxWaterLevel / 2;
        //Debug.Log ("WATER LEVEL " + waterLevel);

        //find Game Controller


        //determine personality
        personality = Random.Range(0, 7);

        // pick a random color
        float R        = Random.Range(.4f, .9f);
        float G        = Random.Range(.4f, .9f);
        float B        = Random.Range(.4f, .9f);
        Color newColor = new Color(R, G, B, 1.0f);

        // apply it on current object's material
        GetComponent <Renderer>().material.color = newColor;

        //opponent villages are not selected
        isSelected     = false;
        markedForDeath = false;
    }
Пример #2
0
    // Use this for initialization
    void Start()
    {
        //instantiate weather effects and music
        deathTollText      = GameObject.Find("DeathTollText").GetComponent <Text> ();
        deathTollText.text = "0 have died";
        winterWeather      = GameObject.Find("WinterWeather");
        winterWeather.SetActive(false);
        springWeather = GameObject.Find("SpringWeather");
        springWeather.SetActive(false);
        summerWeather = GameObject.Find("SummerWeather");
        summerWeather.SetActive(false);
        fallWeather = GameObject.Find("FallWeather");
        fallWeather.SetActive(false);
        fallMusicBoxObject   = GameObject.Find("FallMusicBox");
        springMusicBoxObject = GameObject.Find("SpringMusicBox");
        summerMusicBoxObject = GameObject.Find("SummerMusicBox");
        winterMusicBoxObject = GameObject.Find("WinterMusicBox");
        nightMusicBoxObject  = GameObject.Find("NightMusicBox");
        springMusicBoxScript = springMusicBoxObject.GetComponent <SpringMusicBoxScript> ();
        summerMusicBoxScript = summerMusicBoxObject.GetComponent <SpringMusicBoxScript> ();
        fallMusicBoxScript   = fallMusicBoxObject.GetComponent <SpringMusicBoxScript> ();
        winterMusicBoxScript = winterMusicBoxObject.GetComponent <SpringMusicBoxScript> ();
        nightMusicBoxScript  = nightMusicBoxObject.GetComponent <SpringMusicBoxScript> ();

        //find advisors
        guardScript = GameObject.Find("Guard").GetComponent <GuardScript>();
        witchScript = GameObject.Find("Witch").GetComponent <WitchScript>();

        //find notification text
        notificationText      = GameObject.Find("NotificationText").GetComponent <Text> ();
        notificationText.text = "";

        //Load in txt files to word lists
        loadWordLists();

        //find the screen fader
        screenFader       = GameObject.Find("ScreenFader");
        screenFaderScript = screenFader.gameObject.GetComponent <ScreenFaderScript> ();

        //write season text
        seasonText      = GameObject.Find("SeasonText").GetComponent <Text> ();
        seasonText.text = "spring";

        //set us to night
        isDay = false;

        //create list fo opponents
        opponentList = new List <GameObject>();

        //find the day counter in UI
        dayNumberText = GameObject.Find("DayNumberText").GetComponent <Text>();

        //create the world with opponents, player, and decorations (cursor too)
        CreateWorld();

        //establish reference to well
        well       = GameObject.FindGameObjectWithTag("Well");
        wellScript = well.GetComponent <WellScript> ();

        //establish reference to player village
        myPlayerVillage       = GameObject.FindGameObjectWithTag("PlayerVillage");
        myPlayerVillageScript = myPlayerVillage.gameObject.GetComponent <PlayerVillageScript> ();

        //Camera background
        camera.clearFlags = CameraClearFlags.SolidColor;
        destroyWordLists();
        nightMusicBoxScript.FadeInMusic();

        //color trees
        for (int i = 0; i < trees.Length; i++)
        {
            trees [i].GetComponent <Renderer>().material.color = springSummerTreeColor;
        }

        //set day number
        dayNumberText.text = "night " + dayNumber;
        origOpponents      = opponents;
    }