/// <summary> /// Обработчик окончания цикла туррели /// </summary> /// <param name="obj">сслка на <see cref="WorkingTurret"/></param> public void CycleEnded(Object obj) { WorkingTurret turret = obj as WorkingTurret; if (turret != null) { isEmptyClose = timeToAsterEnd < cycle * LasersCount; } }
/// <summary> /// Initializes a new instance of the <see cref="TimerListItem"/> class. /// </summary> /// <param name="ore">The ore.</param> /// <param name="startVolume">The start volume.</param> /// <param name="cycle">The cycle.</param> /// <param name="miningYield">The mining yield.</param> public TimerListItem(Ore ore, double startVolume, double cycle, double miningYield) { this.ore = ore; this.startVolume = startVolume; currentVolume = StartVolume; this.cycle = cycle; oreUnitPerSecond = miningYield/cycle/ore.Volume; timeToAsterEnd = startVolume/oreUnitPerSecond; if (timeToAsterEnd < cycle) isEmptyClose = true; _turret = new WorkingTurret(cycle, 1.0, ProgressChanged, CycleEnded, "1"); }
/// <summary> /// Обработчик прогресса изменения таймера турели /// </summary> /// <param name="obj">сслка на <see cref="WorkingTurret"/></param> public void ProgressChanged(Object obj) { WorkingTurret turret = obj as WorkingTurret; if (turret != null) { currentVolume -= oreUnitPerSecond * turret.ProgressInterval * LasersCount; timeToAsterEnd -= turret.ProgressInterval * LasersCount; if (timeToAsterEnd <= 0) { currentVolume = 0; timeToAsterEnd = 0; Sound.PlaySound(Settings.AsterEndFileName); } } }
/// <summary> /// Initializes a new instance of the <see cref="TimerListItem"/> class. /// </summary> /// <param name="ore">The ore.</param> /// <param name="startVolume">The start volume.</param> /// <param name="cycle">The cycle.</param> /// <param name="miningYield">The mining yield.</param> public TimerListItem(Ore ore, double startVolume, double cycle, double miningYield) { this.ore = ore; this.startVolume = startVolume; currentVolume = StartVolume; this.cycle = cycle; oreUnitPerSecond = miningYield / cycle / ore.Volume; timeToAsterEnd = startVolume / oreUnitPerSecond; if (timeToAsterEnd < cycle) { isEmptyClose = true; } _turret = new WorkingTurret(cycle, 1.0, ProgressChanged, CycleEnded, "1"); }