Пример #1
0
        public void CompleteJob()
        {
            _data.IsDataStatic = true;
            _data.Status       = JobStatus.Complete;
            _data.Completed    = TimeKeeper.Chronos.Get();
            _data.Earnings     = CostFunction.Evaluate(in _data.Cost, in _data.Completed);

            var drone = GetDrone();

            drone.CompleteJob(this);
            var hub = drone.GetHub();

            if (!IsDelayed)
            {
                hub.UpdateRevenue(Earnings);
            }

            drone.UpdateDelay(Deadline.Timer());
            _data.EnergyUse = drone.DeltaEnergy();
            drone.AssignJob();
            _data.Drone = 0;
            DataLogger.LogJob(_data);
        }
Пример #2
0
        public void FailJob()
        {
            _data.IsDataStatic = true;
            _data.Status       = JobStatus.Failed;
            _data.Completed    = _EoT;
            _data.Earnings     = Loss;

            if (_data.Hub != 0 && !IsDelayed)
            {
                var hub = GetHub();
                hub.UpdateRevenue(Earnings);
                hub.UpdateFailedCount();
            }

            if (_data.Drone != 0)
            {
                var drone = GetDrone();
                _data.EnergyUse = drone.DeltaEnergy();
                drone.AssignJob();
                _data.Drone = 0;
            }

            DataLogger.LogJob(_data);
        }