public void Tick() { if (IsActive) { if (timeTillArrival == 0) // Boat just arrived { if (stones > 0) { God.TheOne.construction.stock += stones; timeTillArrival = GetTimeRequired(); stones = 0; } else { isInDock = true; } } else if (timeTillArrival > 0) { if (God.random.NextDouble() < People.Productivity(People.Community.river)) { timeTillArrival--; // Sometimes they will not move if productivity is to low } } } }
internal override void Tick() { techProgress += 1 + People.PeopleAt(People.Community.road) / 100; if (techProgress > 1000) { techProgress = 1000; } int availablePeople = People.PeopleAt(People.Community.road) - teamsOnTheWay.Sum(t => t.people); if (availablePeople < 0) { God.TheOne.Console("Road has negative people!"); } int availableStones = God.TheOne.quarry.HasStones(); int stonesToBeMoved = Math.Min(availablePeople / teamsize, availableStones); if (stonesToBeMoved > 0) { Team t = new Team(stonesToBeMoved * teamsize, stonesToBeMoved, transportTime); teamsOnTheWay.Add(t); God.TheOne.roadGO.launchTeam(t.id, t.people); if (God.TheOne.quarry.TakeStones(stonesToBeMoved) == false) { throw new Exception("Taking non-existing stones"); } } for (int i = teamsOnTheWay.Count - 1; i >= 0; i--) { if (God.random.NextDouble() < People.Productivity(People.Community.road)) { teamsOnTheWay[i].TimeLeft--; // If the productivity is to low, somtimes they will not move. } if (teamsOnTheWay[i].TimeLeft <= 0) { God.TheOne.river.newStonesArrive(teamsOnTheWay[i].stones); teamsOnTheWay.RemoveAt(i); } } }