示例#1
0
 public EnergyDistributor()
     : base(0, 15, "Energy distribution")
 {//TODO: add auto-overload overload-capable subsystems with unused energy
     StatusReport.Write(() => "Distribution technique: " + Enum.GetName(typeof(Techniques), Technique) + "\n");
     StatusReport.Write(() => "Unused energy: " + Parant.CurrentAvailableEnergy + "/" + Parant.MaxAvailableEnergy + "e/s");
     StatusReport.Write(() => " (" + (int)(Parant.AssignedEnergy / Parant.MaxAvailableEnergy * 100) + " % efficiency) ");
     StatusReport.AddBarGraph(15, () => Parant.CurrentAvailableEnergy / Parant.MaxAvailableEnergy, () => Color.Yellow, () => Color.CornflowerBlue);
     StatusReport.Write("\n");
 }
        public Hull(float maxHullPoints) : base(0, 20, "Hull")
        {
            MaxHullPoints     = maxHullPoints;
            CurrentHullPoints = MaxHullPoints;

            StatusReport.Write("Hull Integrity: ");
            StatusReport.Write(() => "" + (int)CurrentHullPoints, HullStatusColor);
            StatusReport.Write(() => "/" + (int)MaxHullPoints + " hp ");
            StatusReport.AddBarGraph(10, () => CurrentHullPoints / MaxHullPoints, HullStatusColor);
            StatusReport.Write("\n");
        }
示例#3
0
        public Shields(float maxShieldPower, int maxOverload = 2)
            : base(5, 5, "Shield subsystem", maxOverload)
        {
            MaxShieldPower  = maxShieldPower;
            MinEnergyDemand = 10;

            StatusReport.Write("Shield power: ");
            StatusReport.Write(() => "" + (int)CurrentShieldPower, ShieldColor);
            StatusReport.Write(() => "/" + (int)MaxShieldPower + " shl ");
            StatusReport.AddBarGraph(10, () => CurrentShieldPower / MaxShieldPower, ShieldColor);
            StatusReport.Write("\n");
            StatusReport.Write(() => "Regeneration rate: " + CurrentShieldPerSecond.ToString("0.00") + "/" + MaxShieldPerSecond + " shl/s\n");
        }
        public Storage(float capacity)
            : base(3, 4, "Storage")
        {
            MaxNumberOfItems = capacity;

            StatusReport.Write(() => "Storage Capacity: " + NumberOfItems.ToKFloats() + "/" + MaxNumberOfItems + " ", () => NumberOfItems / MaxNumberOfItems > 0.9f ? Color.Red : Color.White);
            StatusReport.AddBarGraph(() => GetBarLenght(MaxNumberOfItems), () => NumberOfItems / MaxNumberOfItems, () => new Color(60, 80, 170));
            StatusReport.Write("\nStorage contents:\n");
            foreach (var item in storage)
            {
                WriteStatusReportForNewItem(item.Value.Name);
            }
        }
        /// <summary>
        /// Resets the maxAmountEverStored and kicks out items with amount=0.
        /// </summary>
        public void CleanUpStorage()
        {
            var keys = storage.Keys.ToList();

            for (int i = 0; i < keys.Count; i++)
            {
                storage[keys[i]].MaxAmountEverStored = storage[keys[i]].Amount;
                if (storage[keys[i]].Amount == 0)
                {
                    storage.Remove(keys[i]);
                }
            }

            InitStatusReport();
            StatusReport.Write(() => "Storage Capacity: " + NumberOfItems.ToKFloats() + "/" + MaxNumberOfItems + " ", () => NumberOfItems / MaxNumberOfItems > 0.9f?Color.Red:Color.White);
            StatusReport.AddBarGraph(() => GetBarLenght(MaxNumberOfItems), () => NumberOfItems / MaxNumberOfItems, () => new Color(60, 80, 170));
            StatusReport.Write("\nStorage contents:\n");
            foreach (var item in storage)
            {
                WriteStatusReportForNewItem(item.Value.Name);
            }
        }
 void WriteStatusReportForNewItem(string name)
 {
     StatusReport.Write(() => storage[name].Name + " (" + (storage[name].Value * storage[name].Amount).ToKFloats() + ") " + storage[name].Amount + " ");
     StatusReport.AddBarGraph(() => GetBarLenght(storage[name].MaxAmountEverStored), () => storage[name].Amount / storage[name].MaxAmountEverStored, () => new Color(60, 80, 170));
     StatusReport.Write("\n");
 }