public bool IsChipPassableAt(TileLayer layer, IntVector2 loc) { TiledMap tiledMap = GetComponent <TiledMap>(); TiledProperty property = tiledMap.GetPropertyForTile("x", layer, loc.x, loc.y); return((property == null) ? true : (property.GetStringValue() == "false")); }
static MapObject BuildNpcObject( int tileWidth, int tileHeight, Dictionary <ushort, string> functionsByEventId, GetTileFunc getTileFunc, Dictionary <int, int> npcPathIndices, int npcIndex, MapNpc npc, ref int nextId) { var objProps = new List <TiledProperty> { new(Prop.Visual, npc.SpriteOrGroup.ToString()), new(Prop.Flags, npc.Flags.ToString()), new(Prop.Triggers, npc.Triggers.ToString()), new(Prop.Movement, npc.Movement.ToString()), new(Prop.Type, npc.Type.ToString()), }; if (!npc.Id.IsNone) { objProps.Add(new TiledProperty(Prop.Id, npc.Id.ToString())); } if (npc.Node != null) { objProps.Add(new TiledProperty(Prop.Script, functionsByEventId[npc.Node.Id])); } if (!npc.Sound.IsNone) { objProps.Add(new TiledProperty(Prop.Sound, npc.Sound.ToString())); } if (npcPathIndices.TryGetValue(npcIndex, out var pathObjectId)) { objProps.Add(TiledProperty.Object(Prop.Path, pathObjectId)); } var(tileId, tileW, tileH) = getTileFunc(npc.SpriteOrGroup); return(new MapObject { Id = nextId++, Gid = tileId ?? 0, Name = $"NPC{npcIndex} {npc.Id}", Type = ObjectGroupMapping.TypeName.Npc, X = npc.Waypoints[0].X * tileWidth, Y = npc.Waypoints[0].Y * tileHeight, Width = tileW, Height = tileH, Properties = objProps }); }