Beispiel #1
0
    public IEnumerator CheckMonopoly(Player player, Property property)
    {
        int ownCount  = 0;
        int propCount = property.propertyGroup.Length;

        Debug.Log("You own this property.");
        // CHECK TO SEE IF MONOPOLY
        foreach (Property p in property.propertyGroup)
        {
            if (p.isOwned)
            {
                if (player.PlayerID == p.playerID)
                {
                    ownCount++;
                }
            }
        }

        if (ownCount == propCount)
        {
            Debug.Log("You have a monopoly.");
            propMonop.gameObject.SetActive(true);
            PropertyOwnMonopoly propMonopComp = GetComponent <PropertyOwnMonopoly>();

            timeLeft -= Time.deltaTime;
            while (noButtonPress == false)
            {
                if (timeLeft < 0)
                {
                    buttonPress = true;
                }
                yield return(null);
            }
            if (property.houseCount == 4 || noButtonPress == true)
            {
                propMonop.gameObject.SetActive(false);
                if (doubleRoll == true)
                {
                    StartCoroutine(RollAgain());
                }
                else
                {
                    IsDoneInteraction = true;
                }
            }
        }
        else
        {
            if (doubleRoll == true)
            {
                StartCoroutine(RollAgain());
            }
            else
            {
                IsDoneInteraction = true;
            }
        }
        noButtonPress = false;
    }
Beispiel #2
0
    // Start is called before the first frame update
    void Start()
    {
        // Get an instance of the propUI object and set it to false ( we ain't using it yet ).
        propUI = GameObject.FindObjectOfType <PropertyUI>();
        propUI.gameObject.SetActive(false);

        // Get an instance of the buyRail object and set it to false ( we ain't using it yet ).
        buyRail = GameObject.FindObjectOfType <BuyRailRoadUI>();
        buyRail.gameObject.SetActive(false);

        // Get an instance of the railOwnedUI object and set it to false.
        railOwned = GameObject.FindObjectOfType <RailOwnedUI>();
        railOwned.gameObject.SetActive(false);

        // Get an instance of the ChanceCardUI object and set it to false.
        chanceCardUI = GameObject.FindObjectOfType <ChanceCardUI>();
        chanceCardUI.gameObject.SetActive(false);

        // Get an instance of the CommunityChestUI object and set it to false.
        commUI = GameObject.FindObjectOfType <CommunityChestUI>();
        commUI.gameObject.SetActive(false);

        // Get instance of property monopoly UI.
        propMonop = GameObject.FindObjectOfType <PropertyOwnMonopoly>();
        propMonop.gameObject.SetActive(false);

        // Get instance of property owned UI.
        propOwnedUi = GameObject.FindObjectOfType <PropertyOwnedUI>();
        propOwnedUi.gameObject.SetActive(false);

        // Get instance of pass go UI.
        passGoUi = GameObject.FindObjectOfType <PassGoUI>();
        passGoUi.gameObject.SetActive(false);

        // Get instance of TaxUI.
        taxUI = GameObject.FindObjectOfType <TaxUI>();
        taxUI.gameObject.SetActive(false);

        // Get instance of UtilUI.
        utilUI = GameObject.FindObjectOfType <UtilityUI>();
        utilUI.gameObject.SetActive(false);

        // Get instance of jailLandedUI.
        jailLanded = GameObject.FindObjectOfType <JailLandedUI>();
        jailLanded.gameObject.SetActive(false);

        // Get instance of GoToJailUI.
        goToJailUI = GameObject.FindObjectOfType <GoToJailUI>();
        goToJailUI.gameObject.SetActive(false);

        // Get instance of InJailUI
        inJailUI = GameObject.FindObjectOfType <InJailUI>();
        inJailUI.gameObject.SetActive(false);

        // Get instance of InJailUI
        doubleRollUI = GameObject.FindObjectOfType <DoubleRollUI>();
        doubleRollUI.gameObject.SetActive(false);

        menu = GameObject.FindObjectOfType <PauseMenu>();
        menu.gameObject.SetActive(false);

        // Get an instance of the ownership class.
        owner = GameObject.FindObjectOfType <Ownership>();

        // Check the players money.
        CheckPlayerMoney();
        Debug.Log("Current player is: " + (CurrentPlayerID + 1));
    }