Exemplo n.º 1
0
    void OnTriggerStay2D(Collider2D other)
    {
        if (other.gameObject.CompareTag("Player"))
        {
            //Debug.Log(name + " detects Chomper!");

            if (Input.GetKeyDown(KeyCode.Space))
            {
                if (player.BasketValue == 0)
                {
                    dialogue = "Eleanor: I'm waiting! I want " + demand + "! >:(";
                    //Debug.Log("I'm waiting! I want " + demand + "!");
                }
                else
                {
                    if (player.BasketValue == demand)
                    {
                        game.UpdateScore(1);
                        dialogue = "Eleanor: That was perfect! Thank you! :)";
                        //Debug.Log("Thank you!");
                    }
                    else if (player.BasketValue > demand)
                    {
                        game.UpdateScore(-1);
                        dialogue = "Eleanor: Ugh. That was too many flowers. "
                                   + "I wanted " + demand + ", but you gave me "
                                   + player.BasketValue + ".";

                        /*Debug.Log("Ugh. That was too many flowers in one sitting.\n"
                         + "I wanted " + demand + ", but you gave me "
                         + player.BasketValue + ".");*/
                    }
                    else
                    {
                        game.UpdateScore(-1);
                        dialogue = "Eleanor: Hey! That was too few flowers! "
                                   + "I wanted " + demand + ", but you gave me "
                                   + player.BasketValue + ".";

                        /*Debug.Log("Hey! That was too few flowers!\n"
                         + "I wanted " + demand + ", but you gave me "
                         + player.BasketValue + ".");*/
                    }

                    player.ClearBasket();
                    game.UpdateBasketText();
                    Order();
                }

                game.SetDialogue(dialogue);
            }
        }
    }
Exemplo n.º 2
0
    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.R))
        {
            ResetFlowers();
        }

        if (Input.GetKeyDown(KeyCode.Backspace))
        {
            player.ClearBasket();
            UpdateBasketText();
        }
    }