Esempio n. 1
0
    void Update()
    {
        if (currentInterObj != null && Input.GetButtonDown("Interact"))
        {
            if (selling == true && controller.gold >= value)
            {
                controller.takeMoney(value);
                prefab = currentInterObj.GetComponent <InteractionObject>().prefab;
                Instantiate(prefab, transform.position, Quaternion.identity);
            }
            else if (jobbing == true && job[1] > workedHours)
            {
                jobMode = true;
            }
            else if (sleeping == true)
            {
                sleepMode        = true;
                controller.sleep = true;

                /*if (time.getHoursDisplay() > 6)
                 * {
                 *
                 *
                 *  time.changeAddedTime((30 - time.getHoursDisplay()) * 60);
                 *  controller.GetHungrier(1);
                 * }
                 * else if (time.getHoursDisplay() < 6)
                 * {
                 *  time.changeAddedTime((6 - time.getHoursDisplay()) * 60);
                 * }
                 * else
                 * {
                 *  time.changeAddedTime((24 * 60));
                 * }*/
            }
            else if (taxing == true)
            {
                if (taxValue > controller.gold)
                {
                    taxExchange = controller.gold;
                    taxValue   -= taxExchange;
                    controller.takeMoney(taxExchange);
                    dialogText.text = "Not all of your tax was paid. You still owe " + taxValue;
                }
                else if (taxValue == 0)
                {
                    dialogText.text = "You've already paid you twat";
                }
                else
                {
                    controller.takeMoney(taxValue);
                    taxValue        = 0;
                    dialogText.text = "Congratulations! You've paid everything. For now";
                    taxOverDue      = false;
                }
            }
            else if (renting == true)
            {
                if (rentValue > controller.gold)
                {
                    rentExchange = controller.gold;
                    rentValue   -= rentExchange;
                    controller.takeMoney(rentExchange);
                    dialogText.text = "Not all of your rent was paid. You still owe " + rentValue;
                }
                else if (rentValue == 0)
                {
                    dialogText.text = "You've already paid you ninny";
                }
                else
                {
                    controller.takeMoney(rentValue);
                    rentValue       = 0;
                    dialogText.text = "Congratulations! You've paid everything. For now";
                }
            }
        }
        if (currentInterObj != null && Input.GetButtonDown("Interact2"))
        {
            if (renting == true)
            {
                if (playerStatus == "pleb")
                {
                    if (controller.gold >= 1000)
                    {
                        dialogText.text = "Huh. You've scrapped enough for a better place. Do you want to upgrade for 1000 gold? Press Z to buy";
                        houseCost       = 1000;
                        housing         = true;
                        potentialStatus = "townfolk";
                    }
                    else if (controller.gold < 1000)
                    {
                        dialogText.text = "Get out of here you pleb and don't come back unless you have 1000";
                    }
                }
                else if (playerStatus == "townfolk")
                {
                    if (controller.gold >= 5000 && rentValue == 0)
                    {
                        dialogText.text = "Huh. You've scrapped enough for a better place. Do you want to upgrade for 5000 gold? Press Z to buy";
                        houseCost       = 5000;
                        housing         = true;
                        potentialStatus = "fancylad";
                    }
                    else if (rentValue > 0)
                    {
                        dialogText.text = "Why don't ya get me my rent money first huh?";
                    }
                    else if (controller.gold < 5000)
                    {
                        dialogText.text = "Get out of here you poor bastard and don't come back unless you have 5000";
                    }
                }
                else if (playerStatus == "fancylad")
                {
                    if (controller.gold >= 15000)
                    {
                        dialogText.text = "Hello sir, would you like to upgrade for 15000? Press Z to buy";
                        houseCost       = 15000;

                        victory = true;
                    }
                    else if (controller.gold < 15000)
                    {
                        dialogText.text = "Sorry sir, but you seem to lack the 15000";
                    }
                }
            }
        }
        if (currentInterObj != null && Input.GetButtonDown("Interact3"))
        {
            if (housing == true)
            {
                dialogText.text = "Congratulations! Your house isn't as shit!";
                playerStatus    = potentialStatus;
                controller.takeMoney(houseCost);
                housing = false;
            }
            else if (victory == true)
            {
                controller.Victory();
            }
        }



        if (jobMode == true)
        {
            if (time.getHoursDisplay() < 22 && time.getHoursDisplay() > 6 && job[1] > workedHours)
            {
                controller.AddMoney(job[0]);
                time.addedTime += (60 - time.getMinutesDisplay());
                workedHours++;
            }
            else
            {
                jobMode = false;
            }
        }
        else if (sleepMode == true)
        {
            if (time.getHoursDisplay() != 6)
            {
                time.addedTime += (60 - time.getMinutesDisplay());
                controller.GetHungrier(1);
                controller.healthRegen(controller.currentFood);
                controller.TakeDamage((controller.deltaHealth) / 2);
            }
            else
            {
                sleepMode        = false;
                controller.sleep = true;
            }
        }

        if (time.getHoursDisplay() == 6)
        {
            workedHours = 0;

            guardScript.taxCollected = false;
            guardScript.checkPlayer  = false;
        }

        if (((int)time.days % 7) == 0 && renewTax == false)
        {
            if (taxValue != 0)
            {
                taxOverDue = true;
                late       = (int)System.Math.Ceiling((double)taxValue * .25);
                taxValue  += late;
            }
            taxValue += 100;
            renewTax  = true;
        }
        else if (((int)time.days % 7) != 0)
        {
            renewTax = false;
        }

        if (((int)time.days % 7) == 0 && renewRent == false)
        {
            if (rentValue != 0)
            {
                late       = (int)System.Math.Ceiling((double)rentValue * .25);
                rentValue += late;
            }
            if (playerStatus == "pleb")
            {
                rentValue += 50;
            }
            else if (playerStatus == "townfolk")
            {
                rentValue += 100;
            }
            else if (playerStatus == "fancylad")
            {
                rentValue += 200;
            }

            renewRent = true;
        }
        else if (((int)time.days % 7) != 0)
        {
            renewRent = false;
        }

        curfew             = time.curfew;
        guardScript.curfew = curfew;
    }