Example #1
0
    private void Start()
    {
        lastHealth = hero.Health.Percentage;
        healthBar.SetValue(lastHealth);

        lastSupply = hero.Supply.Percentage;
        supplyBar.SetValue(lastSupply);
    }
 private void Update()
 {
     if (tutorialUI != null)
     {
         label.text = $"TUTORIAL";
         var max   = tutorialUI.actionsMax;
         var steps = tutorialUI.actionsTotal;
         bar.SetValue((float)steps / max);
     }
     else
     {
         label.text = $"LEVEL {Level.level}";
         var max   = Level.levelSteps;
         var steps = Player.steps;
         bar.SetValue((float)steps / max);
     }
 }
Example #3
0
    private void Update()
    {
        if (GameplayController.GameIsStopped || !Activated)
        {
            return;
        }

        FrameTime += Time.deltaTime * (IsEmpty ? EmptyModifier : IsOverflowing ? OverflowModifier : 1f);

        if (FrameTime >= TimePerFrame)
        {
            FrameTime        -= TimePerFrame;
            Frame             = (Frame + 1) % OnlineSprites.Count;
            MyRenderer.sprite = OnlineSprites[Frame];
        }

        float fillAmount = 0;

        if (HoveredResource != null && HoveredResource.ThisEffectType == ResourceEffectType.Fuel)
        {
            fillAmount = HoveredResource.EffectIntensity;
        }

        CurFuel = Mathf.Max(0, CurFuel - Time.deltaTime * DrainRate);
        FuelBar.SetValue(CurFuel, MaxFuel, MaximumPossibleFuelForAnyReactor, fillAmount);

        if (IsEmpty && curReactorState != ReactorState.Empty)
        {
            ParticleControllerInstance.StartSweatParticle(this);
            AttachedCircuit.Empty();
            ReactorEmptyStartCallback();
            curReactorState = ReactorState.Empty;
        }
        else if (!IsEmpty && curReactorState == ReactorState.Empty)
        {
            ParticleControllerInstance.StopParticle(this);
            AttachedCircuit.ProblemSolved();
            ReactorEmptyEndCallback();
            curReactorState = ReactorState.OK;
        }
        else if (IsOverflowing && curReactorState != ReactorState.Overflow)
        {
            ParticleControllerInstance.StartSteamParticle(this);
            AttachedCircuit.Overloading();
            ReactorOverflowStartCallback();
            curReactorState = ReactorState.Overflow;
        }
        else if (!IsOverflowing && curReactorState == ReactorState.Overflow)
        {
            ParticleControllerInstance.StopParticle(this);
            AttachedCircuit.ProblemSolved();
            ReactorOverflowEndCallback();
            curReactorState = ReactorState.OK;
        }
    }