int DrinkBeer(bool success) { if (success) { hero.GetComponent <Animator>().Play("DrinkingBeer"); uiController.DrinkBeer(10); uiController.AddDrinkingExperience(10); } return(0); }
void TakeAction(string action) { switch (action) { case "drinkBeer": hero.GetComponent <Animator>().Play("DrinkingBeer"); uiController.DrinkBeer(10); uiController.AddDrinkingExperience(10); break; default: break; } }
// Update is called once per frame void Update() { if (preparingKegStand) { prepareTimer -= Time.deltaTime; if (prepareTimer <= 0.0f) { preparingKegStand = false; settingUpKegStand = true; SetUpKegStand(); } } if (settingUpKegStand) { startTimer -= Time.deltaTime; if (startTimer <= 0.0f) { settingUpKegStand = false; StartKegStand(); } } if (drinking) { drinkingTimer -= Time.deltaTime; if (drinkingTimer <= 0.0f) { drinkingTimer = .2f; uiController.DrinkBeer(2); } pointsTimer -= Time.deltaTime; if (pointsTimer <= 0.0f) { pointsTimer = 1.0f; pointsCounter++; var newPoints = 10 + (pointsCounter * 5); uiController.AddPartyPoints( newPoints, new Vector3(transform.position.x, transform.position.y + 1.0f, -2.0f)); } // If a tap, find what was clicked on and act on it if (Input.GetMouseButtonUp(0)) { Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); RaycastHit hit; if (Physics.Raycast(ray, out hit)) { switch (hit.collider.name) { case "StopKegStand": StopKegStand(); break; } } } } }