コード例 #1
0
ファイル: BaseEntity.cs プロジェクト: lamanchy/metal_rain
        protected virtual void FixedUpdate()
        {
            if (!IsPowered)
            {
                return;
            }

            Energy            = Mathf.Clamp(Energy + EnergyPerTick, 0, MaxEnergy);
            energyLight.color = HexColors.EnergyColor(Energy);
            PowerDownCheck();
        }
コード例 #2
0
ファイル: BaseEntity.cs プロジェクト: lamanchy/metal_rain
        protected virtual void Start()
        {
            Pathfinder.AllTiles[Position].standingEntity = this;
            AlignToGrid();

            // Setup energy visualization
            energyLight = new GameObject("EnergyLight", typeof(Light)).GetComponent <Light>();
            energyLight.transform.SetParent(transform);
            energyLight.transform.localPosition = new Vector3(0f, 0.1f, 0f);
            energyLight.color     = HexColors.EnergyColor(Energy);
            energyLight.range     = 1;
            energyLight.intensity = 10;

            PowerUpCheck();
            PowerDownCheck();
        }
コード例 #3
0
        private void Update()
        {
            energyBar.UpdateBar(
                $"{Format(CurrentTarget.Energy)} / {Format(CurrentTarget.MaxEnergy)} ({CurrentTarget.EnergyPerSecond}/s)",
                CurrentTarget.Energy / CurrentTarget.MaxEnergy,
                HexColors.EnergyColor(CurrentTarget.Energy)
                );

            if (Mothership.IsThawing)
            {
                thawBar.gameObject.SetActive(true);
                thawBar.UpdateBar(
                    $"{Mothership.FreezeValue / Mothership.ThawPerSecond:n0} seconds until death",
                    Mothership.FreezeValue / Mothership.MaxFreeze,
                    Color.red
                    );
            }
            else
            {
                thawBar.gameObject.SetActive(false);
            }
        }