public Simulation(EpisodeContentManager Content, float SimStepLength) { this.SimStepLength = SimStepLength; SimStepTime = 0.0f; var definitionFile = Content.OpenUnbuiltTextStream("blocks.txt").ReadToEnd(); var loadedBlocks = BlockSetLoader.LoadDefinitionFile(definitionFile); Blocks = new BlockSet { Tiles = new TileSheet(Content.Load<Texture2D>("tiles"), 16, 16), Templates = loadedBlocks.NamedBlocks }; World = new CellGrid(16, 16, 16); World.forAll((t, x, y, z) => { if (z <= 1) t.Block = Blocks.Templates["Grass"]; else t.Block = null; }); World.CellAt(4, 4, 1).SetFlag(CellFlags.Storehouse, true); World.CellAt(1, 1, 2).Block = Blocks.Templates["Slope"]; World.CellAt(1, 1, 2).BlockOrientation = CellLink.Directions.North; World.CellAt(1, 2, 2).Block = Blocks.Templates["Slope"]; World.CellAt(1, 2, 2).BlockOrientation = CellLink.Directions.East; World.CellAt(1, 3, 2).Block = Blocks.Templates["Slope"]; World.CellAt(1, 3, 2).BlockOrientation = CellLink.Directions.South; World.CellAt(1, 4, 2).Block = Blocks.Templates["Slope"]; World.CellAt(1, 4, 2).BlockOrientation = CellLink.Directions.West; World.CellAt(8, 8, 6).Block = Blocks.Templates["Grass"]; World.CellAt(6, 6, 1).Decal = Blocks.Templates["TrackH"]; World.CellAt(7, 6, 2).Block = Blocks.Templates["Slope"]; World.CellAt(7, 6, 2).BlockOrientation = CellLink.Directions.West; World.CellAt(7, 6, 2).Decal = Blocks.Templates["TrackV"]; Actors = new List<Actor>(); Tasks = new List<Task>(); Minds = new List<GnomeMind>(); World.PrepareNavigation(); World.MarkDirtyChunk(); for (int i = 0; i < 4; ++i) { var gnomeActor = new Gnome(this, Blocks.Tiles); gnomeActor.Location = new Coordinate(0, i, 1); Actors.Add(gnomeActor); Minds.Add(gnomeActor.Mind); } }
public NudgedTask(Gnome Nudger, Coordinate Location) : base(Location) { this.Nudger = Nudger; }
public GnomeMind(Gnome Owner) { this.Owner = Owner; }
public Task FindTask(Gnome Gnome) { return Tasks.FirstOrDefault(t => t.AssignedGnome == null); }