public void Play(Model.Graph graph) { if (IsMoving = (Target = graph.Near(gsApi.World.Me.Position)) != null) { gsApi.MoveTo(Target.Point); } }
private void InstantiateTemplate(Model.Graph templateGraph, Entity targetEntity) { Dictionary <Entity, Entity> templateToInstanceMapping = new(); // instantiate all entities from template and remember mapping foreach (var templateEntity in templateGraph.Entities) { var templateInstance = templateEntity.CreateDuplicate(_graph, targetEntity); templateToInstanceMapping.Add(templateEntity, templateInstance); targetEntity.AddChild(templateInstance); } // add internal relations between instantiated entities foreach (var templateLayer in templateGraph.GetLayers()) { Layer layer = _graph.GetOrAddLayer(templateLayer.Name); foreach (var templateRelation in templateLayer.Relations) { var from = templateToInstanceMapping[templateRelation.Entities[0]]; var to = templateToInstanceMapping[templateRelation.Entities[1]]; layer.AddRelation(from, to, templateRelation.Name); } } }
public WfcGraphSpace(Model.Graph graph, List <WfcGraphTile <TTileData> > availableModules, Blackboard blackboard, string wfcComponentName = "WfcComponent", string wfcCellPropertyName = "WfcCell", string wfcNeighborLayerName = "WfcNeighborLayer") : base(blackboard) { _graph = graph; _wfcComponentName = wfcComponentName; _wfcCellPropertyName = wfcCellPropertyName; _wfcNeighborLayerName = wfcNeighborLayerName; InitializeEntities(availableModules); }
public static void ShowEdgesNumber(Model.Graph graph) { System.Console.WriteLine("Liczba krawedzi grafu: " + graph.NEdges.ToString()); }
public WfcGraphTile(Model.Graph graph, Func <WfcGraphTile <TTileData>, WfcCell <WfcGraphTile <TTileData>, int>, WfcSpace <WfcGraphTile <TTileData>, int>, bool> canModuleBePlacedFunction) { Graph = graph; _canModuleBePlacedFunction = canModuleBePlacedFunction; TileDescriptor = new TileDescriptor <TTileData>(); }