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); }
void errorGreetingState() { stateAnim.SetBool("isCorrect", false); stateAnim.SetBool("isGreeted", true); GreetingSounds.instance.playSound("fail"); RestaurantGlobals.reduceScore(); }
// 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; } } } }
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(); } } } } }
// Use this for initialization void Start() { scoreText = GetComponent <Text> (); scoreText.text = "" + RestaurantGlobals.getScore(); }
// Update is called once per frame void Update() { scoreText.text = "" + RestaurantGlobals.getScore(); }
// Update is called once per frame void Update() { anim.SetInteger("day", RestaurantGlobals.getDay()); }
public void OnBeginDrag(PointerEventData eventData) { //RestaurantGlobals.setDragging (true); RestaurantGlobals.setGreetingButton(this); drag = true; }