Exemplo n.º 1
0
 public void ShowRetry()
 {
     StopCoroutine("CloseWinUI");
     winUI.SetActive(false);
     loseUI.SetActive(true);
     GetHighScore();
     SetHighScore();
     loseScoreDisplay.text     = score.GetValue() + "";
     loseHighScoreDisplay.text = "Best: " + highScore;
 }
Exemplo n.º 2
0
        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();
                }
            }
        }
Exemplo n.º 3
0
 public void UpdateUI()
 {
     sb.Clear();
     sb.Append("Lvl ");
     sb.Append(lvl.GetValue().ToString());
     lvlText.text = sb.ToString();
 }
Exemplo n.º 4
0
        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");
        }
Exemplo n.º 7
0
        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);
     }
 }
Exemplo n.º 9
0
        public void AddScore(int scoreToAdd)
        {
            int currentScore = scoreValue.GetValue();
            int updatedScore = currentScore + scoreToAdd;

            scoreValue.SetValue(updatedScore);

            if (updatedScore > limitForLevel)
            {
                GameFlowManager.NextLevel();
            }
        }
Exemplo n.º 10
0
        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}");
            }
        }
Exemplo n.º 11
0
    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();
        }
Exemplo n.º 13
0
    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();
    }
Exemplo n.º 14
0
        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);
            }
        }
Exemplo n.º 15
0
 public int GetValue()
 {
     return(variable.GetValue());
 }
Exemplo n.º 16
0
 private void Start()
 {
     myText.text = fleasGlobalVal.GetValue().ToString("##0");
 }
Exemplo n.º 17
0
 private void Start()
 {
     this.scoreText.text = score.GetValue().ToString();
 }
Exemplo n.º 18
0
 private void Update()
 {
     myText.text = scorevariable.GetValue().ToString("### ##0");
 }
Exemplo n.º 19
0
 private int GetLifes()
 {
     return(lifes.GetValue());
 }
Exemplo n.º 20
0
 private bool AllStarsPickedUp()
 {
     return(currentStar.GetValue() == maxStar.GetValue());
 }
Exemplo n.º 21
0
 public void UpdateCurrentHealth()
 {
     heartsForeground.rectTransform.sizeDelta = new Vector2(currentHealth.GetValue() * tileSize, tileSize);
 }
Exemplo n.º 22
0
 public void UpdateMaxHealth()
 {
     heartsBackground.rectTransform.sizeDelta = new Vector2(maxHealth.GetValue() * tileSize, tileSize);
 }
Exemplo n.º 23
0
 /// <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();
 }