コード例 #1
0
ファイル: WeightAnalizer.cs プロジェクト: kpiatkowski/ExcavOS
            private void CalculateCapacityDelta(TimeSpan time)
            {
                WeightPoint wp = new WeightPoint
                {
                    time     = time.TotalSeconds,
                    capacity = _cargoManager.CurrentCapacity / _cargoManager.TotalCapacity
                };

                if (addedWeightPoints < MaxWeightPoints)
                {
                    _weightPoints[addedWeightPoints] = wp;
                    addedWeightPoints++;
                    CapacityDelta = 0;
                }
                else
                {
                    for (int n = 1; n < MaxWeightPoints; n++)
                    {
                        _weightPoints[n - 1] = _weightPoints[n];
                    }
                    _weightPoints[MaxWeightPoints - 1] = wp;

                    float capacityIncrease = (float)(_weightPoints[MaxWeightPoints - 1].capacity - _weightPoints[0].capacity);
                    float timeIncrease     = (float)(_weightPoints[MaxWeightPoints - 1].time - _weightPoints[0].time);
                    CapacityDelta = capacityIncrease / timeIncrease;
                }
            }
コード例 #2
0
 /// <summary>Служит хэш-функцией по умолчанию.</summary>
 /// <returns>Хэш-код для текущего объекта.</returns>
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = ActNumber;
         hashCode = (hashCode * 397) ^ (ActDateTime != null ? ActDateTime.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ PpvkNumber;
         hashCode = (hashCode * 397) ^ (WeightPoint != null ? WeightPoint.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Weighter != null ? Weighter.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Vehicle != null ? Vehicle.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Driver != null ? Driver.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Cargo != null ? Cargo.GetHashCode() : 0);
         return(hashCode);
     }
 }
コード例 #3
0
 public async Task AddWeightPointAsync(Guid userId, DateTime weightDate, int weight)
 {
     WeightPoint weightPoint = WeightPoint.Create(userId, weight, weightDate);
     await _weightPointRepository.AddAsync(weightPoint);
 }
コード例 #4
0
ファイル: SceneMaker.cs プロジェクト: tsss-t/SimpleStory
 public void CreateDataStart(int floorNum)
 {
     this.floorNum = floorNum;
     nowWeightPoint = new WeightPoint();
     mode = MakeMode.MakeDataMode;
     areaDataList = new List<AreaData>();
     enemyDataList = new List<EnemyPositionData>();
     MakeUpPoint();
 }
コード例 #5
0
ファイル: SceneMaker.cs プロジェクト: tsss-t/SimpleStory
 public void CreateStart()
 {
     nowWeightPoint = new WeightPoint();
     mode = MakeMode.MakeSceneMode;
     MakeUpPoint();
 }
コード例 #6
0
        public async Task AddAsync(WeightPoint weightPoint)
        {
            await _context.WeightPoints.AddAsync(weightPoint);

            await _context.SaveChangesAsync();
        }