Пример #1
0
    public void StartBidding(VacantUI vacant)
    {
        startingCostText.text = "";
        playerCount           = 0;
        playerInCount         = 4;
        startingCost          = 0;
        biddingTimer          = bidTimer;

        uiText.text = "";
        doneBidding = true;
        player1bid  = false; player2bid = false; player3bid = false; player4bid = false;

        first     = false;
        roundOver = false; countingDown = false;

        player1first = false; player2first = false; player3first = false; player4first = false;

        player1ready = false; player2ready = false; player3ready = false; player4ready = false;
        readyUp      = false;
        Debug.Log("i count that there are " + playerCount.ToString() + "players");

        readyUp  = true;
        vacantui = vacant;
        camera.TurnCanMoveFalse();

        Debug.Log("Gamecontroller says there are " + gameController.playerCount.ToString() + "players");
        for (int i = 0; i < playerPanels.Length; i++)
        {
            playerPanels[i].SetActive(i < gameController.playerCount);
        }

        /*
         * for (int i = gameController.playerCount; i < playerPanels.Length; i++) {
         *  playerPanels[i].SetActive(false);
         * }
         */
        /*for (int i = 0; i < playerBidDisplays.Length; i++) {
         *  playerBidDisplays[i].text = "";
         * }*/
        vacantTile            = vacant.building;
        bids                  = new double[] { vacantTile.price, vacantTile.price, vacantTile.price, vacantTile.price };
        startingCost          = vacantTile.price;
        startingCostText.text = "Starting Cost: $" + startingCost.ToString();
        //biddingPanel.SetActive(true);
        //winnerPanel.SetActive(false);
        //tiedPanel.SetActive(false);
        //doneBidding = false;
        biddingTimer = bidTimer;
        uiText.text  = readyUpText;
        for (int i = 0; i < playerPanels.Length; i++)
        {
            if (playerPanels[i].activeSelf == true)
            {
                playerCount += 1;
                Debug.Log("i count that there are " + playerCount.ToString() + "players");
            }
        }
    }
Пример #2
0
    // Use this for initialization
    void Start()
    {
        for (int i = 0; i < 11; i++)
        {
            GameObject          tile       = Instantiate(urbanFab, new Vector3(-1, 0, i - 5), Quaternion.identity);
            WorldTile           tileScript = tile.GetComponent <WorldTile>();
            BuildingResidential building   = ScriptableObject.CreateInstance <BuildingResidential>();

            building.canvas     = mainCanvas;
            building.tile       = tileScript;
            tileScript.building = building;

            building.name = BuildingResidential.GenerateName(ResidentType.URBAN);
            int population = Random.Range(2, 6);
            for (int j = 0; j < population; j++)
            {
                Pop currentPop = new Pop();
                currentPop.income             = (IncomeLevel)Random.Range(0, 3);
                currentPop.preference         = (FoodPreference)Random.Range(0, 4);
                currentPop.favoriteIngredient = (RecipeIngredient)Random.Range(0, Ingredient.OPTIONS_COUNT);
                if (Random.value > 0.5f)
                {
                    currentPop.hatedIngredient = (RecipeIngredient)Random.Range(1, Ingredient.OPTIONS_COUNT);
                }
                else
                {
                    currentPop.hatedIngredient = RecipeIngredient.EMPTY;
                }
                building.residents.Add(currentPop);
            }
        }

        for (int i = 0; i < 11; i++)
        {
            GameObject          tile       = Instantiate(suburbFab, new Vector3(0, 0, i - 5), Quaternion.identity);
            WorldTile           tileScript = tile.GetComponent <WorldTile>();
            BuildingResidential building   = ScriptableObject.CreateInstance <BuildingResidential>();

            building.canvas     = mainCanvas;
            building.tile       = tileScript;
            tileScript.building = building;

            building.name = BuildingResidential.GenerateName(ResidentType.SUBURB);

            int population = Random.Range(1, 5);
            for (int j = 0; j < population; j++)
            {
                Pop currentPop = new Pop();
                currentPop.income             = (IncomeLevel)Random.Range(0, 3);
                currentPop.preference         = (FoodPreference)Random.Range(0, 4);
                currentPop.favoriteIngredient = (RecipeIngredient)Random.Range(0, Ingredient.OPTIONS_COUNT);
                if (Random.value > 0.5f)
                {
                    currentPop.hatedIngredient = (RecipeIngredient)Random.Range(1, Ingredient.OPTIONS_COUNT);
                }
                else
                {
                    currentPop.hatedIngredient = RecipeIngredient.EMPTY;
                }
                building.residents.Add(currentPop);
            }
        }

        for (int i = 0; i < 11; i++)
        {
            GameObject          tile       = Instantiate(roadFab, new Vector3(1, 0, i - 5), Quaternion.identity);
            WorldTile           tileScript = tile.GetComponent <WorldTile>();
            BuildingResidential building   = ScriptableObject.CreateInstance <BuildingResidential>();

            building.canvas     = mainCanvas;
            building.tile       = tileScript;
            tileScript.building = building;

            building.name = BuildingResidential.GenerateName(ResidentType.ROAD);

            int population = Random.Range(2, 4);
            for (int j = 0; j < population; j++)
            {
                Pop currentPop = new Pop();
                currentPop.income             = (IncomeLevel)Random.Range(0, 3);
                currentPop.preference         = (FoodPreference)Random.Range(0, 4);
                currentPop.favoriteIngredient = (RecipeIngredient)Random.Range(0, Ingredient.OPTIONS_COUNT);
                if (Random.value > 0.5f)
                {
                    currentPop.hatedIngredient = (RecipeIngredient)Random.Range(1, Ingredient.OPTIONS_COUNT);
                }
                else
                {
                    currentPop.hatedIngredient = RecipeIngredient.EMPTY;
                }
                building.residents.Add(currentPop);
            }
        }

        for (int i = 0; i < 11; i++)
        {
            GameObject     tile       = Instantiate(emptyLotFab, new Vector3(2, 0, i - 5), Quaternion.identity);
            WorldTile      tileScript = tile.GetComponent <WorldTile>();
            BuildingVacant building   = ScriptableObject.CreateInstance <BuildingVacant>();

            building.canvas     = mainCanvas;
            building.tile       = tileScript;
            tileScript.building = building;

            building.name = "Vacant Lot";

            building.price = 10 * Random.Range(10, 51);
        }
    }