private void AddLvlToSlider() { PlayerPrefs.SetInt(CurrentLvlOfSliderPrefsName, PlayerPrefs.GetInt(CurrentLvlOfSliderPrefsName) + 1); for (int i = 1; i <= TimesOfAddingInSlider + 1; i++) { if (i != TimesOfAddingInSlider + 1) { Invoke("AddLittlePartToSlider", 0.01f * i); } else { if (PlayerPrefs.GetInt(CurrentLvlOfSliderPrefsName) == 3) { Invoke("FirstPopUp", 1); _coinsModel.AddCoins(250); } else if (PlayerPrefs.GetInt(CurrentLvlOfSliderPrefsName) == 6) { PopUPSquare1.SetTrigger("Visible"); Invoke("SecondPopUp", 1); _coinsModel.AddCoins(500); } else if (PlayerPrefs.GetInt(CurrentLvlOfSliderPrefsName) == 4 || PlayerPrefs.GetInt(CurrentLvlOfSliderPrefsName) == 5) { PopUPSquare1.SetTrigger("Visible"); } } } }
void HitTopBlock(CollisionInfo collision) { if (collision.obj.blockType == BlockType.breakable) { if (poweredUp) { AudioManager.PlaySound(AudioManager.main.breakBlock, 1); BreakTile(collision.obj.transform.position); Destroy(collision.obj.gameObject); } else { collision.obj.StartBounce(); } } else if (collision.obj.blockType == BlockType.coinblock) { Animator animator = collision.obj.gameObject.GetComponent <Animator>(); if (!animator.GetBool("used")) { AudioManager.PlaySound(AudioManager.main.coin, 1); coins.AddCoins(1); AddPoints(200, true, collision.obj.transform.position); animator.SetBool("used", true); collision.obj.StartBounce(); } } else { collision.obj.StartBounce(); } }
void Update() { if (place) { //StartCoroutine(w()); Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); RaycastHit hit; if (Physics.Raycast(ray, out hit, Mathf.Infinity) && !EventSystem.current.IsPointerOverGameObject(1) && c.coins >= plcb.cost && hit.transform.tag == "Flor") { Vector3 objectPos = hit.point; objectPos.x = Mathf.Round(objectPos.x / squareSize) * squareSize; objectPos.z = Mathf.Round(objectPos.z / squareSize) * squareSize; objectPos.y = objectPos.y - 1; GameObject gm = Instantiate(templateSprite, objectPos, new Quaternion(0, 0, 0, 0)); gm.GetComponent <SpriteRenderer>().sprite = plcb.obj; gm.name = plcb.name; nMS.BuildNavMesh(); if (plcb.tower) { SphereCollider scol = gm.AddComponent <SphereCollider>(); scol.isTrigger = false; Tower tower = gm.AddComponent <Tower>(); tower.tier = plcb.tier; tower.Setup(); } c.AddCoins(-plcb.cost); place = false; plcb = null; } } }
public void OnClick() { if (!_isCollected) { _rewardCount = (int)(_coins.CoinsPerVisit * _buyer.BonusRate); _coins.AddCoins(_rewardCount); _text.text = _rewardCount.ToString(); _button.interactable = false; _animation.Play(); _isCollected = true; Destroy(gameObject, 1.5f); } }
void HandleShowResult(ShowResult result) { if (result == ShowResult.Finished) { Debug.Log("Video completed - Offer a reward to the player of " + coinAmmount + "Coins!"); // Reward your player here. c.AddCoins(coinAmmount); } else if (result == ShowResult.Skipped) { Debug.LogWarning("Video was skipped - Do NOT reward the player"); } else if (result == ShowResult.Failed) { Debug.LogError("Video failed to show"); } }