Esempio n. 1
0
    string correctGreeting()
    {
        string retval;

        if (direction == 1)
        {
            retval = btnArigatou.name;
        }
        else
        {
            int day = RestaurantGlobals.getDay();

            if (day == 1)
            {
                retval = btnOhayou.name;
            }
            else if (day == 2)
            {
                retval = btnKonnichiwa.name;
            }
            else
            {
                retval = btnKonwbanwa.name;
            }
        }

        return(retval);
    }
Esempio n. 2
0
 void errorGreetingState()
 {
     stateAnim.SetBool("isCorrect", false);
     stateAnim.SetBool("isGreeted", true);
     GreetingSounds.instance.playSound("fail");
     RestaurantGlobals.reduceScore();
 }
Esempio n. 3
0
    // Update is called once per frame
    void Update()
    {
        if (RestaurantGlobals.stop == false)
        {
            if (numberOfTimes > 0)
            {
                timeBar.value += Time.deltaTime;

                if (timeBar.value >= timeBar.maxValue)
                {
                    numberOfTimes--;
                    RestaurantGlobals.incrementDay();
                    timeBar.value = 0;
                }
            }
        }
    }
Esempio n. 4
0
    void OnTriggerEnter2D(Collider2D other)
    {
        Debug.Log(gameObject.name + " is triggered");

        if (RestaurantGlobals.isDragging() == false)
        {
            RestaurantGlobals.unsetGreetingButton();
            GreetingSounds.instance.playSound(other.name);

            if (other.gameObject.name == trigger1.name || other.gameObject.name == trigger2.name)
            {
                moving = false;
                transform.Translate(new Vector3(0f, 0f, 0f));
                rigidBody.velocity = Vector2.zero;
                timeToMove         = Random.Range(2, 5);
                setAnimation();
                Debug.Log(gameObject.name + " is restarting.");
            }
            else if (isGreeted == false)
            {
                if (other.name == lineCollider.name)
                {
                    errorGreetingState();
                    isGreeted = true;
                }
                else
                {
                    isGreeted = true;
                    Debug.Log(correctGreeting());
                    if (other.name == correctGreeting())
                    {
                        correctGreetingState();
                    }
                    else
                    {
                        errorGreetingState();
                    }
                }
            }
        }
    }
Esempio n. 5
0
 // Use this for initialization
 void Start()
 {
     scoreText      = GetComponent <Text> ();
     scoreText.text = "" + RestaurantGlobals.getScore();
 }
Esempio n. 6
0
 // Update is called once per frame
 void Update()
 {
     scoreText.text = "" + RestaurantGlobals.getScore();
 }
Esempio n. 7
0
 // Update is called once per frame
 void Update()
 {
     anim.SetInteger("day", RestaurantGlobals.getDay());
 }
Esempio n. 8
0
 public void OnBeginDrag(PointerEventData eventData)
 {
     //RestaurantGlobals.setDragging (true);
     RestaurantGlobals.setGreetingButton(this);
     drag = true;
 }