Пример #1
0
        private void DrawTrader(CompPowerTrader trader)
        {
            if (trader == null)
            {
                throw new ArgumentNullException("trader");
            }

            // get a nice descriptive color
            Color color = Color.clear;

            if (trader.PowerOn)
            {
                color = GenUI.MouseoverColor;
            }
            else if (
                (!trader.PowerOn) &&
                (trader.DesirePowerOn)
                )
            {
                color = Color.red;
            }
            else
            {
                color = Color.grey;
            }

            MiniMap_Utilities.DrawThing(texture, trader.parent, color);
        }
Пример #2
0
        private void DrawTransmitter(CompPowerTransmitter transmitter)
        {
            if (transmitter == null)
            {
                throw new ArgumentNullException("transmitter");
            }

            // get a nice descriptive color
            Color color = Color.clear;

            if (transmitter.transNet == null)
            {   // not connected
                color = Color.red;
            }
            else
            {     // connected
                if (transmitter.transNet.CurrentEnergyGainRate() > 0f)
                { // excess power
                    color = GenUI.MouseoverColor;
                }
                else if (transmitter.transNet.CurrentStoredEnergy() > 1f)
                {   // stored power
                    color = Color.green;
                }
                else
                {   // not enough power
                    color = Color.red;
                }
            }

            MiniMap_Utilities.DrawThing(texture, transmitter.parent, color);
        }
Пример #3
0
        private void DrawBattery(CompPowerBattery battery)
        {
            if (battery == null)
            {
                throw new ArgumentNullException("battery");
            }

            var color = Color.clear;

            // blue if gaining energy
            if (battery.PowerNet?.CurrentEnergyGainRate() > 1f)
            {
                color = GenUI.MouseoverColor;
            }

            // green if draining but has power
            else if (battery.StoredEnergy > 1f)
            {
                color = Color.green;
            }

            // red if out of power
            else
            {
                color = Color.red;
            }

            MiniMap_Utilities.DrawThing(texture, battery.parent, color);
        }