public void ShowRetry() { StopCoroutine("CloseWinUI"); winUI.SetActive(false); loseUI.SetActive(true); GetHighScore(); SetHighScore(); loseScoreDisplay.text = score.GetValue() + ""; loseHighScoreDisplay.text = "Best: " + highScore; }
public void Check() { int tempLvl = level.GetValue(); int tempBrk = breakCount.GetValue(); if (tempLvl < data.levels.Count) { int lvlUp = data.levels[tempLvl].breakCount; if (tempBrk >= lvlUp) { IncreaseLevel(); sfx.Play(); } } }
public void UpdateUI() { sb.Clear(); sb.Append("Lvl "); sb.Append(lvl.GetValue().ToString()); lvlText.text = sb.ToString(); }
public void UpdateCanvas() { ClearLifes(); int currentLifes = GetLifes(); for (int i = 1; i <= currentLifes; i++) { if (i == currentLifes && HP.GetValue() < 100) { Instantiate( halfHP, transform.position, Quaternion.identity, transform ); } else { Instantiate( livePrefab, transform.position, Quaternion.identity, transform ); } } }
private void AddFlea() { int newFleasValue = fleaScore.GetValue() + 1; fleaScore.SetValue(newFleasValue); fleaCollected.Invoke(); }
public void TryFloatVictoryPlatforms() { if (currentStars.GetValue() < maxStars.GetValue()) { return; } StartCoroutine("FloatVictoryPlatforms"); }
public void CollectSpark() { float amount = Charge + 1.0f; Charge = Mathf.Clamp(amount, 0, MaxCharge.GetValue()); int sparksCollected = SparksCollected.GetValue() + 1; SparksCollected.SetValue(sparksCollected); }
public void ShowPlayInstruction() { if (currentLevel.GetValue() == 1) { playInstruction.SetActive(true); } else { playInstruction.SetActive(false); } }
public void AddScore(int scoreToAdd) { int currentScore = scoreValue.GetValue(); int updatedScore = currentScore + scoreToAdd; scoreValue.SetValue(updatedScore); if (updatedScore > limitForLevel) { GameFlowManager.NextLevel(); } }
private void Update() { bool isDown = Input.GetMouseButton(0); EInputPhase currentPhase = (EInputPhase)Phase.GetValue(); EInputPhase newPhase = EInputPhase.None; if (isDown) { switch (currentPhase) { case EInputPhase.None: newPhase = EInputPhase.Begin; break; case EInputPhase.Begin: newPhase = EInputPhase.Hold; break; case EInputPhase.Hold: newPhase = EInputPhase.Hold; break; } Vector2 oldPosition = Position.GetValue(); Vector2 newPosition = Input.mousePosition; newPosition.y = m_Camera.pixelHeight; if (oldPosition != newPosition) { Position.SetValue(newPosition); } } else { switch (currentPhase) { case EInputPhase.Hold: newPhase = EInputPhase.End; break; case EInputPhase.End: newPhase = EInputPhase.None; break; } } if (currentPhase != newPhase) { Phase.SetValue((int)newPhase); Debug.Log($"Input phase: {newPhase}"); } }
private IEnumerator RecieveItemAnimation(InventoryItem item, GameObject itemObject) { _isRecievingItem = true; yield return(_itemController.RecieveItemAnimation(item, itemObject)); _itemController.neededItems.Clear(); _itemController.DestroySpeechBubble(); numberOfFinalItems.SetValue(numberOfFinalItems.GetValue() + 1); _isRecievingItem = false; if (numberOfFinalItems.GetValue() == 2) { _spriteRenderer.flipX = !_spriteRenderer.flipX; bigHeartAnimator.SetTrigger("startStory"); canPlayerMove.SetValue(false); _itemController.canPlayerInteract.SetValue(false); } }
private IEnumerator ReleaseFleas(Collider2D other) { for (int i = 1; i <= fleasCollected.GetValue(); i++) { Flea flea = Instantiate(fleaPrefab, other.transform.position, Quaternion.identity); AudioClip fleaJumpSFX = flea.GetComponent <AudioSource>().clip; AudioSource.PlayClipAtPoint(fleaJumpSFX, transform.position); flea.JumpOnTarget(townToRelease); yield return(new WaitForSeconds(fleaReleaseTimeGap)); } PlayEndingCinematic(); }
public void AddHealth(int healthToAdd) { int currentLifes = lifesSO.GetValue(); if (HPSO.GetValue() >= 100) { if (currentLifes < maxLifes) { AddLife(currentLifes); SetHP(healthToAdd); } } else { SetHP(100); } onGetHp.Invoke(); }
public void ShowNext() { winUI.SetActive(true); StartCoroutine("CloseWinUI"); //GetHighScore(); //SetHighScore(); levelDisplay.text = "Level " + (currentLevel.GetValue() - 1) + ""; //winScoreDisplay.text = score.GetValue() + ""; //winHighScoreDisplay.text = "Best: " + highScore; for (int i = 0; i < spawnPos.childCount; i++) { GameObject conf1 = Instantiate(confetti1, confettiUI.transform); conf1.transform.position = spawnPos.GetChild(i).position; Destroy(conf1, 3f); GameObject conf2 = Instantiate(confetti2, confettiUI.transform); conf2.transform.position = spawnPos.GetChild(i).position; Destroy(conf2, 3f); } }
public int GetValue() { return(variable.GetValue()); }
private void Start() { myText.text = fleasGlobalVal.GetValue().ToString("##0"); }
private void Start() { this.scoreText.text = score.GetValue().ToString(); }
private void Update() { myText.text = scorevariable.GetValue().ToString("### ##0"); }
private int GetLifes() { return(lifes.GetValue()); }
private bool AllStarsPickedUp() { return(currentStar.GetValue() == maxStar.GetValue()); }
public void UpdateCurrentHealth() { heartsForeground.rectTransform.sizeDelta = new Vector2(currentHealth.GetValue() * tileSize, tileSize); }
public void UpdateMaxHealth() { heartsBackground.rectTransform.sizeDelta = new Vector2(maxHealth.GetValue() * tileSize, tileSize); }
/// <summary> /// Increases the current level and raises the onLevelVarChange event then calls LoadLevel /// </summary> public void LoadNextLevel() { GameAnalytics.NewProgressionEvent(GAProgressionStatus.Complete, Application.version, levelToLoad.Variable.GetValue().ToString("00000"), score.GetValue()); levelToLoad.Variable.Add(1); onLevelVarChange.Raise(); LoadLevel(); }