Ejemplo n.º 1
0
 private void Update()
 {
     if (!this.isShining)
     {
         base.StartCoroutine(this.ShinyEffect());
     }
     if (this.currentAmount != this.targetAmount && Time.realtimeSinceStartup >= this.nextUpdate && this.labels != null)
     {
         this.nextUpdate = Time.realtimeSinceStartup + SoftCurrencyButton.updateInterval;
         int deltaAmount = SoftCurrencyButton.GetDeltaAmount(this.currentAmount, this.targetAmount);
         if (this.currentAmount < this.targetAmount)
         {
             this.currentAmount += deltaAmount;
         }
         else if (this.currentAmount > this.targetAmount)
         {
             this.currentAmount -= deltaAmount;
         }
         for (int i = 0; i < this.labels.Length; i++)
         {
             this.labels[i].text = string.Format("{0}", this.currentAmount);
         }
     }
     if (this.targetAmount - this.currentAmount != 0)
     {
         this.PlayLoopSound();
     }
     else
     {
         this.StopLoopSound();
     }
     this.OnUpdate();
 }
Ejemplo n.º 2
0
 private void Update()
 {
     if (!Singleton <PlayerProgress> .IsInstantiated())
     {
         return;
     }
     if (this.currentExperience == Singleton <PlayerProgress> .Instance.ExperienceToNextLevel && Singleton <PlayerProgress> .Instance.LevelUpPending && this.currentState == PlayerProgressBar.State.Regular)
     {
         this.SetState((!ResourceBar.Instance.IsItemEnabled(ResourceBar.Item.PlayerProgress) || !this.canLevelUp) ? PlayerProgressBar.State.WaitingLevelInactive : PlayerProgressBar.State.WaitingLevelActive);
     }
     if (this.currentExperience != this.targetExperience && Time.realtimeSinceStartup >= this.nextUpdate && this.resourceBarItem.IsShowing && this.currentState == PlayerProgressBar.State.Regular)
     {
         this.nextUpdate = Time.realtimeSinceStartup + SoftCurrencyButton.updateInterval;
         int deltaAmount = SoftCurrencyButton.GetDeltaAmount(this.currentExperience, this.targetExperience);
         if (this.currentExperience < this.targetExperience)
         {
             this.currentExperience += deltaAmount;
         }
         else if (this.currentExperience > this.targetExperience)
         {
             this.currentExperience -= deltaAmount;
         }
         int experienceToNextLevel = Singleton <PlayerProgress> .Instance.ExperienceToNextLevel;
         int level = Singleton <PlayerProgress> .Instance.Level;
         this.currentExperience = Mathf.Min(this.currentExperience, experienceToNextLevel);
         TextMeshHelper.UpdateTextMeshes(this.levelLabel, level.ToString(), false);
         TextMeshHelper.UpdateTextMeshes(this.experienceLabel, string.Format("{0}/{1}", this.currentExperience, experienceToNextLevel), false);
         float d = Mathf.Clamp((float)this.currentExperience / (float)experienceToNextLevel, 0.001f, 1f);
         this.experienceFillMeter.localScale = Vector3.forward + Vector3.up + Vector3.right * d * this.maxFill;
     }
 }
Ejemplo n.º 3
0
 private void Update()
 {
     if (this.machineArrow != null)
     {
         float   value = this.machineArrowTargetAngle + 360f + (Mathf.Sin(Time.time * this.machineArrowStutterStrength) + Mathf.Sin(Time.time * 2f * this.machineArrowStutterStrength) * this.machineArrowStutterStrength * 0.4f);
         Vector3 b     = Vector3.forward * Mathf.Clamp(value, 1f, 359f);
         this.arrowAngleFade += GameTime.DeltaTime;
         this.machineArrow.localEulerAngles = Vector3.Lerp(Vector3.forward * this.machineArrowFromAngle, b, this.arrowAngleFade);
     }
     if (this.targetMachineScrapAmount != this.currentMachineScrapAmount && Time.realtimeSinceStartup >= this.nextLabelUpdate)
     {
         this.nextLabelUpdate = Time.realtimeSinceStartup + SoftCurrencyButton.updateInterval;
         int deltaAmount = SoftCurrencyButton.GetDeltaAmount(this.currentMachineScrapAmount, this.targetMachineScrapAmount);
         if (this.currentMachineScrapAmount < this.targetMachineScrapAmount)
         {
             this.currentMachineScrapAmount += deltaAmount;
         }
         else if (this.currentMachineScrapAmount > this.targetMachineScrapAmount)
         {
             this.currentMachineScrapAmount -= deltaAmount;
         }
         this.UpdateMachineScrapLabel();
     }
     if (!this.IsMachineLocked && this.queuedAddScrapActions > 0)
     {
         this.queuedAddScrapActions--;
         this.AddScrap(0);
     }
 }