private void ShowCoins(int Count)
 {
     graphController.GoToNodeByName("Coins");
     CoinsProgr.SetValue(Count);
     ObtCoinsProgr.gameObject.SetActive(true);
     ObtCoinsProgr.SetValue(Count);
 }
 private void ShowBrawlerPower(int Count)
 {
     graphController.GoToNodeByName("Brawler Power");
     BrawlerPowerProgr.SetValue(Count);
     //ObtBrawlerPowerProgr.SetValue(Count);
     //ObtBrawlerPowerProgr.gameObject.SetActive(true);
 }
Ejemplo n.º 3
0
 protected override void InitPersonParameters()
 {
     base.InitPersonParameters();
     EnergyParameter.OnChangeValue.AddListener(energy =>
     {
         if (energy >= EnergyParameter.MaxValue)
         {
             energy = EnergyParameter.MaxValue;
         }
         if (energy <= 0)
         {
             energy = 0;
         }
         EnergyProgressor.SetValue(energy);
     });
     EnergyProgressor.SetMax(EnergyParameter.MaxValue);
     EnergyProgressor.SetValue(EnergyParameter.Value);
     HealthParameter.OnChangeValue.AddListener(health =>
     {
         EnergyParameter.Value += EnergyParameter.MaxValue / 10;
     });
 }
Ejemplo n.º 4
0
 protected virtual void InitPersonParameters()
 {
     _personAnimator = GetComponent <PersonAnimatorDragonBones>();
     _personAnimator.AnimationTimeScale = AnimationTimeScaleParameter.Value;
     HealthParameter.OnChangeValue.AddListener(health =>
     {
         if (health >= HealthParameter.MaxValue)
         {
             health = HealthParameter.MaxValue;
         }
         HpProgressor.SetValue(health);
     });
     HpProgressor.SetMax(HealthParameter.MaxValue);
     HealthParameter.Value = HealthParameter.MaxValue;
 }
    void LateUpdate()
    {
        if (won)
        {
            return;
        }
        if (currentPressureValue != targetPressureValue)
        {
            currentPressureValue = Mathf.Lerp(currentPressureValue, targetPressureValue, (1 / lerpTime) * Time.deltaTime);
            if (Mathf.Abs(currentPressureValue - targetPressureValue) < 0.001f)
            {
                currentPressureValue = targetPressureValue;
            }
        }

        indicator.value = currentPressureValue;

        if (currentPressureValue >= 0.65f)
        {
            loseTimer = Mathf.Max(0, loseTimer - Time.deltaTime);
        }
        else
        {
            loseTimer = Mathf.Min(maxLoseTime, loseTimer + Time.deltaTime * 2);
        }

        timeProgressor.SetValue(maxLoseTime - loseTimer);
        src.pitch = 1 + timeProgressor.Value / maxLoseTime;

        //Lose
        if (loseTimer <= 0)
        {
            GameObject.FindGameObjectWithTag("Player").GetComponent <Player>().PressureFailure();
            chooser.Stop();
            src.Stop();
            this.enabled = false;
        }

        //Win
        if (currentPressureValue == targetPressureValue && targetPressureValue == 0.6f)
        {
            GameEventMessage.SendEvent("GameWon");
            StartCoroutine(GameWon());
            won = true;
        }
    }
Ejemplo n.º 6
0
 /// <summary>
 /// Sets the health bar value
 /// </summary>
 /// <param name="value">should be between 0 to 1</param>
 public void SetHealthBarValue(int value)
 {
     if (!hpProgressor)
     {
         hp = value;
         return;
     }
     hpProgressor.SetValue(value);
     //if (HealthBarImage.fillAmount < 0.2f)
     //{
     //    SetHealthBarColor(Color.red);
     //}
     //else if (HealthBarImage.fillAmount < 0.4f)
     //{
     //    SetHealthBarColor(Color.yellow);
     //}
     //else
     //{
     //    SetHealthBarColor(Color.green);
     //}
 }
Ejemplo n.º 7
0
 public BattleStateUI updateSP(int sp)
 {
     spProgressor.SetValue(sp);
     return(this);
 }
Ejemplo n.º 8
0
 public BattleStateUI updateHP(int hp)
 {
     hpProgressor.SetValue(hp);
     return(this);
 }
Ejemplo n.º 9
0
        private IEnumerator ShowEnumerator(bool instantAction)
        {
            RectTransform.FullScreen(true);
            Overlay.FullScreen(true);

            yield return(null); //skip a frame

            DisableUIInteractions();

            UIAnimator.StopAnimations(Container.RectTransform, ShowBehavior.Animation.AnimationType); //stop any SHOW animations
            Container.Enable();                                                                       //enable the gameobject, canvas and graphic raycaster
            Overlay.Enable();

            //MOVE
            Vector3 moveFrom = UIAnimator.GetAnimationMoveFrom(Container.RectTransform, ShowBehavior.Animation, Container.StartPosition);
            Vector3 moveTo   = UIAnimator.GetAnimationMoveTo(Container.RectTransform, ShowBehavior.Animation, Container.StartPosition);

            if (!ShowBehavior.Animation.Move.Enabled)
            {
                Container.ResetPosition();
            }
            UIAnimator.Move(Container.RectTransform, ShowBehavior.Animation, moveFrom, moveTo, instantAction); //initialize and play the SHOW Move tween

            //ROTATE
            Vector3 rotateFrom = UIAnimator.GetAnimationRotateFrom(ShowBehavior.Animation, Container.StartRotation);
            Vector3 rotateTo   = UIAnimator.GetAnimationRotateTo(ShowBehavior.Animation, Container.StartRotation);

            if (!ShowBehavior.Animation.Rotate.Enabled)
            {
                Container.ResetRotation();
            }
            UIAnimator.Rotate(Container.RectTransform, ShowBehavior.Animation, rotateFrom, rotateTo, instantAction); //initialize and play the SHOW Rotate tween

            //SCALE
            Vector3 scaleFrom = UIAnimator.GetAnimationScaleFrom(ShowBehavior.Animation, Container.StartScale);
            Vector3 scaleTo   = UIAnimator.GetAnimationScaleTo(ShowBehavior.Animation, Container.StartScale);

            if (!ShowBehavior.Animation.Scale.Enabled)
            {
                Container.ResetScale();
            }
            UIAnimator.Scale(Container.RectTransform, ShowBehavior.Animation, scaleFrom, scaleTo, instantAction); //initialize and play the SHOW Scale tween

            //FADE
            float fadeFrom = UIAnimator.GetAnimationFadeFrom(ShowBehavior.Animation, Container.StartAlpha);
            float fadeTo   = UIAnimator.GetAnimationFadeTo(ShowBehavior.Animation, Container.StartAlpha);

            if (!ShowBehavior.Animation.Fade.Enabled)
            {
                Container.ResetAlpha();
            }
            UIAnimator.Fade(Container.RectTransform, ShowBehavior.Animation, fadeFrom, fadeTo, instantAction); //initialize and play the SHOW Fade tween

            Visibility = VisibilityState.Showing;                                                              //update the visibility state
            if (!VisiblePopups.Contains(this))
            {
                VisiblePopups.Add(this);
            }
            ShowBehavior.OnStart.Invoke(gameObject, !instantAction, !instantAction);
            NotifySystemOfTriggeredBehavior(AnimationType.Show); //send the global events
            if (HideProgressor != null)
            {
                HideProgressor.SetValue(0f);
            }

            float startTime = Time.realtimeSinceStartup;

            if (!instantAction) //wait for the animation to finish
            {
//                yield return new WaitForSecondsRealtime(ShowBehavior.Animation.TotalDuration);

                float totalDuration = ShowBehavior.Animation.TotalDuration;
                float elapsedTime   = startTime - Time.realtimeSinceStartup;
                while (elapsedTime <= totalDuration) //wait for seconds realtime (ignore Unity's Time.Timescale)
                {
                    elapsedTime        = Time.realtimeSinceStartup - startTime;
                    VisibilityProgress = elapsedTime / totalDuration;
                    yield return(null);
                }
            }

            ShowBehavior.OnFinished.Invoke(gameObject, !instantAction, !instantAction);

            Visibility = VisibilityState.Visible; //update the visibility state
            if (!VisiblePopups.Contains(this))
            {
                VisiblePopups.Add(this);
            }

            if (AutoHideAfterShow)
            {
                Hide(AutoHideAfterShowDelay);
            }
            StartCoroutine(ExecuteShowSelectDeselectButtonEnumerator()); //select the selectedButton
            m_showCoroutine = null;                                      //clear the coroutine reference
            EnableUIInteractions();

            RemoveHiddenFromVisiblePopups();
        }