public void Seed(Actor self) { var cell = Util.RandomWalk(self.Location, self.World.SharedRandom) .Take(Info.MaxRange) .SkipWhile(p => !self.World.Map.Contains(p) || (resLayer.GetResourceType(p) == resourceType && resLayer.IsFull(p))) .Cast <CPos?>().FirstOrDefault(); if (cell != null && resLayer.CanSpawnResourceAt(resourceType, cell.Value)) { resLayer.AddResource(resourceType, cell.Value, 1); } }
protected override void Created(Actor self) { var resourcePoint = self.World.Map.CellContaining(self.CenterPosition) + new CVec(-1, 0); resourceLayer.AddResource(resourceType, resourcePoint, Info.Amount); }