Exemplo n.º 1
0
        private void CowSellBid(int windowID)
        {
            GUI.contentColor = backgroundColor;

            if (!GameController.Instance().cowSelected)
            {
                GUI.Label(new Rect(70, 30, 210, 45), "", labelSelect);
            }

            scrollCowList.transform.position = new Vector2(windowRect.center.x, scrollListPaddingY);

            if (GameController.Instance().cowSelected&& GameController.Instance().cows.Count != 0)
            {
                SetHealth(GameController.Instance().cows[GameController.Instance().cowIndex].health / 100f);
                SetHappiness(GameController.Instance().cows[GameController.Instance().cowIndex].happiness / 10f);

                healthBar.transform.position    = new Vector2(windowRect.center.x + 64, healthHappinessPaddingY + 35);
                happinessBar.transform.position = new Vector2(windowRect.center.x + 64, healthHappinessPaddingY);

                if (!GameController.Instance().cows[GameController.Instance().cowIndex].gender == true)
                {
                    cowGender = "Female";

                    if (GameController.Instance().cows[GameController.Instance().cowIndex].pregnant == true)
                    {
                        cowPregnant = "Yes";
                    }
                }
                else
                {
                    cowGender = "Male";
                    GameController.Instance().cows[GameController.Instance().cowIndex].pregnant = false;
                    cowPregnant = "No";
                }

                GUI.Label(new Rect(110, 20, 150, 30), GameController.Instance().player.name, customTextStyle);
                GUI.Label(new Rect(90, 50, 150, 30), "Cash: € " + GameController.Instance().player.cash, customTextStyle);
                GUI.Label(new Rect(110, 90, 150, 30), "Going In: " + MartBidControl.currentTimer + "s", customTextStyle);
                GUI.Label(new Rect(25, 135, 80, 25), "", labelAge);
                GUI.Label(new Rect(132, 132, 150, 30), "" + GameController.Instance().cows[GameController.Instance().cowIndex].age, customTextStyle);
                GUI.Label(new Rect(25, 170, 90, 25), "", labelBreed);
                GUI.Label(new Rect(132, 170, 150, 30), "" + GameController.Instance().cows[GameController.Instance().cowIndex].breed, customTextStyle);
                GUI.Label(new Rect(25, 205, 110, 30), "", labelHappiness);
                GUI.Label(new Rect(25, 240, 90, 25), "", labelHealth);
                GUI.Label(new Rect(25, 275, 110, 30), "", labelPregnant);
                GUI.Label(new Rect(150, 275, 150, 30), "" + cowPregnant, customTextStyle);
                GUI.Label(new Rect(25, 313, 90, 25), "", labelGender);
                GUI.Label(new Rect(132, 313, 150, 30), "" + cowGender, customTextStyle);
                GUI.Label(new Rect(25, 350, 90, 30), "", labelWeight);
                GUI.Label(new Rect(132, 350, 150, 30), "" + GameController.Instance().cows[GameController.Instance().cowIndex].weight + " KG", customTextStyle);

                GUI.Label(new Rect(65, 400, 150, 30), "Current Bid: € " + MartBidControl.currentCowBid, customTextStyle);

                if (!cowInRing)
                {
                    if (GUI.Button(new Rect(105, 445, 120, 40), "", buttonSell))
                    {
                        if (GameController.Instance().cows.Count != 0)
                        {
                            if (!cowInRing)
                            {
                                GetComponent <AudioSource>().PlayOneShot(buttonSound, 0.6f);
                                MartBidControl.biddingCow = GameController.Instance().cows[GameController.Instance().cowIndex];
                                CowMaker.SpawnCow(MartBidControl.biddingCow, 109f, 137f, Vector3.zero);
                                StartBidding();
                                CreateScrollList.RemoveCowButton(GameController.Instance().cowIndex);
                            }
                        }
                    }
                }
            }

            if (!cowInRing)
            {
                if (GUI.Button(new Rect(295, 450, 35, 35), "", buttonX))
                {
                    GetComponent <AudioSource>().PlayOneShot(buttonSound, 0.6f);
                    if (GameController.Instance().cowSelected)
                    {
                        GameController.Instance().cowSelected = false;
                        MartBidControl.cowList.SetActive(true);
                        SetHealth(0f);
                        SetHappiness(0f);
                    }
                    else
                    {
                        GameController.Instance().martCowMenuUI    = true;
                        GameController.Instance().martCowSellBidUI = false;
                        MartBidControl.cowList.SetActive(false);
                        joyStick.gameObject.SetActive(true);
                        cameraControl.FollowPlayer();
                    }
                }
            }
        }
Exemplo n.º 2
0
        private void CowBuyBid(int windowID)
        {
            GUI.contentColor = backgroundColor;

            SetHealth(MartBidControl.biddingCow.health / 100f);
            SetHappiness(MartBidControl.biddingCow.happiness / 10f);

            healthBar.transform.position    = new Vector2(windowRect.center.x + 64, healthHappinessPaddingY + 35);
            happinessBar.transform.position = new Vector2(windowRect.center.x + 64, healthHappinessPaddingY);

            if (!MartBidControl.biddingCow.gender == true)
            {
                cowGender = "Female";

                if (MartBidControl.biddingCow.pregnant == true)
                {
                    cowPregnant = "Yes";
                }
            }
            else
            {
                cowGender = "Male";
                MartBidControl.biddingCow.pregnant = false;
                cowPregnant = "No";
            }

            GUI.Label(new Rect(110, 20, 150, 30), GameController.Instance().player.name, customTextStyle);
            GUI.Label(new Rect(90, 50, 150, 30), "Cash: € " + GameController.Instance().player.cash, customTextStyle);
            GUI.Label(new Rect(110, 90, 150, 30), "Going In: " + MartBidControl.currentTimer + "s", customTextStyle);
            GUI.Label(new Rect(25, 135, 80, 25), "", labelAge);
            GUI.Label(new Rect(132, 132, 150, 30), "" + MartBidControl.biddingCow.age, customTextStyle);
            GUI.Label(new Rect(25, 170, 90, 25), "", labelBreed);
            GUI.Label(new Rect(132, 170, 150, 30), "" + MartBidControl.biddingCow.breed, customTextStyle);
            GUI.Label(new Rect(25, 205, 110, 30), "", labelHappiness);
            GUI.Label(new Rect(25, 240, 90, 25), "", labelHealth);
            GUI.Label(new Rect(25, 275, 110, 30), "", labelPregnant);
            GUI.Label(new Rect(150, 275, 150, 30), "" + cowPregnant, customTextStyle);
            GUI.Label(new Rect(25, 313, 90, 25), "", labelGender);
            GUI.Label(new Rect(132, 313, 150, 30), "" + cowGender, customTextStyle);
            GUI.Label(new Rect(25, 350, 90, 30), "", labelWeight);
            GUI.Label(new Rect(132, 350, 150, 30), "" + MartBidControl.biddingCow.weight + " KG", customTextStyle);

            GUI.Label(new Rect(65, 400, 150, 30), "Current Bid: € " + MartBidControl.currentCowBid, customTextStyle);

            if (!cowInRing)
            {
                if (GUI.Button(new Rect(70, 445, 170, 35), "", buttonStartBid))
                {
                    if (MartBidControl.cowsInMart.Count != 0)
                    {
                        GetComponent <AudioSource>().PlayOneShot(buttonSound, 0.6f);
                        GameController.Instance().cowIndex = Random.Range(0, MartBidControl.cowsInMart.Count - 1);
                        MartBidControl.biddingCow = MartBidControl.cowsInMart[GameController.Instance().cowIndex];
                        StartBidding();
                    }
                }
            }

            if (!MartBidControl.playerBidLast && cowInRing)
            {
                if (GameController.Instance().player.cash >= MartBidControl.currentCowBid)
                {
                    if (GUI.Button(new Rect(125, 445, 80, 40), "", buttonBid))
                    {
                        GetComponent <AudioSource>().PlayOneShot(buttonSound, 0.6f);
                        BidOnCow(null, MartBidControl.currentCowBid += 500);
                        MartBidControl.playerBidLast = true;
                        LookAtRing();
                    }
                }
            }

            if (!cowInRing)
            {
                if (GUI.Button(new Rect(295, 450, 35, 35), "", buttonX))
                {
                    GetComponent <AudioSource>().PlayOneShot(buttonSound, 0.6f);
                    GameController.Instance().martCowMenuUI   = true;
                    GameController.Instance().martCowBuyBidUI = false;
                    joyStick.gameObject.SetActive(true);
                    cameraControl.FollowPlayer();
                }
            }
        }