public void ComsumeLive() { if (!GloableVeribale.PlayOn) { LivesManager.ConsumeLife(); } }
public void SpendLife(int count) { if (GetLife() > 0) { /*lifes -= count; * PlayerPrefs.SetInt("Lifes", lifes); * PlayerPrefs.Save();*/ _lifeManager.ConsumeLife(); } //else //{ // GameObject.Find("Canvas").transform.Find("RestoreLifes").gameObject.SetActive(true); //} }
/// <summary> /// Play button event handler. /// </summary> public void OnButtonPressed() { if (LivesManager.ConsumeLife()) { // Go to your game! } else { // Tell player to buy lives, then: // LivesManager.GiveOneLife(); // or // LivesManager.FillLives(); } }
/// <summary> /// Play (consume life) button event handler. /// </summary> public void OnButtonConsumePressed() { if (LivesManager.ConsumeLife()) { // Go to your game! Debug.Log("A life was consumed and the player can continue!"); ResultDisplay.Show(true); } else { // Tell player to buy lives, then: // LivesManager.GiveOneLife(); // or // LivesManager.FillLives(); Debug.Log("Not enough lives to play!"); ResultDisplay.Show(false); } }
void Update() { tail.transform.localPosition = new Vector3(0.9640498f, -1.442163f, 0); if (disabledState == 0) { foreach (SpriteRenderer skin in skins) { skin.color = new Color32(255, 255, 255, 255); } } else if (disabledState == 1) { foreach (SpriteRenderer skin in skins) { skin.color = new Color32(255, 255, 255, 255); } } else if (disabledState == 2) { foreach (SpriteRenderer skin in skins) { skin.color = new Color32(255, 255, 0, 255); } } else if (disabledState == 3) { foreach (SpriteRenderer skin in skins) { skin.color = new Color32(148, 30, 30, 255); } } if ((Input.touchCount > 0 && Input.GetTouch(0).phase == TouchPhase.Began)) { if ((EventSystem.current.IsPointerOverGameObject(Input.GetTouch(0).fingerId)) && (inTut == false)) { Debug.Log("Hit UI, Ignore Touch"); } else { target = Camera.main.ScreenToWorldPoint(Input.mousePosition); target.z = transform.position.z; currentPos = transform.position; currentPos.z = transform.position.z; //chck for collisions in the direction of click if (disabledState == 0) { RaycastHit2D hit = Physics2D.Raycast(target, Vector3.up, distance, hits); if (hit.collider != null && opening == false) { StartCoroutine(hookshot(hit.point, currentPos)); line.enabled = true; SnakeHead.SetActive(true); } else if (hit.collider != null && opening == true) { if (livesManager.ConsumeLife()) { gm.business = true; StartCoroutine(hookshot(hit.point, currentPos)); line.enabled = true; SnakeHead.SetActive(true); opening = false; } else { menuManager.noLivesOn(); } } else { return; } } } } }