private WeatherInfo GetNextWeather() { var duration = FastRandom.NextTimeSpan(_updateInterval); return(_current == null ? new WeatherInfo(GetRandomWeather(), GetRandomWeather(), duration) : new WeatherInfo(_current.Next, GetRandomWeather(), duration)); }
public void Update(TimeSpan time) { while (_riftCounts < 10 && !(_zone is StrongHoldZone)) { _nextRiftSpawns.AddLast(new TimeTracker(FastRandom.NextTimeSpan(_spawnTime))); Interlocked.Increment(ref _riftCounts); } //If exit rift dies on stronghold, respawn it if (_riftCounts < 1 && _zone is StrongHoldZone) { _nextRiftSpawns.AddLast(new TimeTracker(FastRandom.NextTimeSpan(_spawnTime))); Interlocked.Increment(ref _riftCounts); } _nextRiftSpawns.RemoveAll(t => { t.Update(time); if (!t.Expired) { return(false); } SpawnRift(); return(true); }); }
private bool SelectPrimaryTarget(TimeSpan time) { var locks = _turret.GetLocks().Where(l => l.State == LockState.Locked).ToArray(); if (locks.Length <= 0) { return(false); } _primarySelectTimer.Update(time); if (_primarySelectTimer.Passed) { _primarySelectTimer.Interval = FastRandom.NextTimeSpan(_minCycleTime); var validLocks = new List <UnitLock>(); foreach (var l in locks) { var unitLock = (UnitLock)l; if (unitLock.Primary) { continue; } var visibility = _turret.GetVisibility(unitLock.Target); if (visibility == null) { continue; } var r = visibility.GetLineOfSight(false); if (r != null) { if (r.hit && (r.blockingFlags & BlockingFlags.Plant) == 0) { continue; } } validLocks.Add(unitLock); } if (validLocks.Count > 0) { var newPrimary = validLocks.RandomElement(); _turret.SetPrimaryLock(newPrimary); return(true); } } return(locks.Any(l => l.Primary)); }
private DateTime SelectNextIntrusionStartTime() { var waitTime = FastRandom.NextTimeSpan(_intrusionWaitTime); var startTime = DateTime.Now + waitTime; if (IntrusionPauseTime.IsBetween(startTime)) { startTime += IntrusionPauseTime.Delta; } return(startTime); }
public void Update(TimeSpan time) { while (_riftCounts < 20) { _nextRiftSpawns.AddLast(new TimeTracker(FastRandom.NextTimeSpan(_spawnTime))); Interlocked.Increment(ref _riftCounts); } _nextRiftSpawns.RemoveAll(t => { t.Update(time); if (!t.Expired) { return(false); } SpawnRift(); return(true); }); }