예제 #1
0
    // Update is called once per frame
    void Update()
    {
        bool timeChange = false;

        if (Input.GetKeyDown("f"))
        {
            Blackboard.FillBowl();
            Log("You fill Vito's bowl with dog food.");
        }
        else if (Input.GetKeyDown("t"))
        {
            //Figure out how a treat should change blackboard values
            Log("You give Vito a tasty treat.");
        }
        else if (Input.GetKeyDown("k"))
        {
            if (Blackboard.playing)
            {
                Blackboard.thrown = true;
                Log("You throw a stick for Vito.");
            }
            else
            {
                Log("You get ready to play fetch with Vito.");
                Blackboard.playing = true;
            }
        }
        else if (Input.GetKeyDown("p"))
        {
            Blackboard.DeltaLonely(-10);
            if (Blackboard.GetLonely() < 10)
            {
                Blackboard.SetLonely(0);
            }
            Log("You pet Vito.");
        }
        else if (Input.GetKeyDown("b"))
        {
            Log("You rub Vito's belly.");
        }
        else if (Input.GetKeyDown("w"))
        {
            Log("You and Vito go for a walk");
            Blackboard.isGoOut = true;
        }
        else if (Input.GetKeyDown("l"))
        {
            Log("You give Vito some time to himself.");
        }
        else if (Input.GetKeyDown("g"))
        {
            Log("You go to work, the grind never stops.");
        }
        else if (Input.GetKeyDown("a"))
        {
            Log("You get home from work, the grind took a break.");
        }
        else if (Input.GetKeyDown("i"))
        {
            Log("15 minutes passes");
            Clock.AdvanceTime(15);
            timeChange = true;
        }
        else if (Input.GetKeyDown("h"))
        {
            Log("An hour passes.");
            Clock.AdvanceTime(60);
            timeChange = true;
        }
        else if (Input.GetKeyDown("d"))
        {
            Log("A new day begins.");
            timeChange = true;
            Clock.addDay();
        }
        else if (Input.GetKeyDown("s"))
        {
            Log("Vito hears a mysterious noise!");
            Blackboard.HeardNoise = true;
        }
        else if (Input.GetKeyDown("1"))
        {
            readoutVisible = !readoutVisible;
        }

        float hours   = Clock.getTime() / 60;
        float minutes = Clock.getTime() % 60;

        clock.text = hours.ToString("00") + ":" + minutes.ToString("00");


        if (readoutVisible)
        {
            readout.gameObject.GetComponentInParent <CanvasRenderer>().gameObject.transform.localScale = new Vector3(1, 1, 1);
            readout.text = "Lonely: " + Blackboard.GetLonely() + "\nHungry: " + Blackboard.GetHungry() + "\nTired: " + Blackboard.GetTired() + "\nGo out:" + Blackboard.GetGoOut();
        }
        else
        {
            readout.gameObject.GetComponentInParent <CanvasRenderer>().gameObject.transform.localScale = new Vector3(0, 0, 0);
        }
    }