Exemple #1
0
    public void updateHoliday()
    {
        //implementing JSON - randomise the first wish among the locations, then randomise the other two from holiday attributes
        locationWish   = wishDatabase[Random.Range(0, 6)];
        attributeWish1 = wishDatabase[Random.Range(7, wishDatabase.Count)];
        attributeWish2 = wishDatabase[Random.Range(7, wishDatabase.Count)];

        //Check the two attributes aren't the same
        while (attributeWish1.wishID == attributeWish2.wishID)
        {
            attributeWish2 = wishDatabase[Random.Range(7, wishDatabase.Count)];
        }

        //HOLIDAY CHECKS - checking some clashing locations haven't been chosen together
        //Check warm weather isn't with cool
        while (attributeWish1.wishID == "13" && attributeWish2.wishID == "14" || attributeWish2.wishID == "13" && attributeWish1.wishID == "14")
        {
            attributeWish2 = wishDatabase[Random.Range(7, wishDatabase.Count)];
        }
        //Check cool weather isn't with beach
        //Check extravagant isn't with cheap


        holidayStat01 = Random.Range(1, 6);
        holidayStat02 = Random.Range(1, 6);

        dialogueBox.SetActive(true);

        while (holidayStat02 == holidayStat01)
        {
            holidayStat02 = Random.Range(1, 6);
        }

        holidayStat03 = Random.Range(1, 6);

        while (holidayStat03 == holidayStat02 || holidayStat03 == holidayStat01)
        {
            holidayStat03 = Random.Range(1, 6);
        }

        holidayDescription.text = " " + resourcesObject.GetComponent <holidayWishes>().holidayRequestPt1[Random.Range(1, resourcesObject.GetComponent <holidayWishes>().holidayRequestPt1.Length)] + " I want to go to the " + locationWish.stampName + ", and I want it to be " + attributeWish1.stampName + " and " + attributeWish2.stampName + "!";
    }
Exemple #2
0
    public void setupHoliday(HolidayWish locationWish, HolidayWish attributeWish1, HolidayWish attributeWish2)
    {
        GameObject addedHoliday = Instantiate(postcardTemplate);

        addedHoliday.transform.SetParent(content.transform, false);
        addedHoliday.GetComponent <postcardScript>().locationWish   = locationWish;
        addedHoliday.GetComponent <postcardScript>().attributeWish1 = attributeWish1;
        addedHoliday.GetComponent <postcardScript>().attributeWish2 = attributeWish2;

        //Updating the display that shows the amount of active holidays the player has!
        activeHolidayCountText.text = GameObject.FindGameObjectsWithTag("ScrollViewPostCardButton").Length.ToString();

        //Checking if the amount of active holidays the player has is equal to 0 - if so, hiding the button display!
        if (GameObject.FindGameObjectsWithTag("ScrollViewPostCardButton").Length == 0)
        {
            activeHolidayCountButton.SetActive(false);
        }
        else
        {
            activeHolidayCountButton.SetActive(true);
        }
    }