Example #1
0
        private StructureType _structureType; // What type of object this is

        #endregion Fields

        #region Constructors

        public GameStructure(string ID, string structureType, Vector2 tilePosition)
            : base()
        {
            _ID = ID;
            _structureType = StructureManager.GetType(structureType);
            base.TilePosition = tilePosition; // Set the tile position of the entity
            base.Position = new Vector2(tilePosition.X * Constants.TILE_SIZE, tilePosition.Y * Constants.TILE_SIZE);
        }
Example #2
0
        public static void LoadStructureBank(string file, ContentManager content)
        {
            using (var reader = new StreamReader(TitleContainer.OpenStream(file)))
            {
                string line;
                while ((line = reader.ReadLine()) != null)
                {
                    if (line.StartsWith("#") == false && string.IsNullOrEmpty(line) == false)
                    {
                        string[] split = line.Split(',');
                        string id = split[0];
                        string name = split[1];
                        string description = split[2];
                        string sprite = split[3];
                        int width = int.Parse(split[4]);
                        int height = int.Parse(split[5]);

                        StructureType newStructure = new StructureType(id, name, description, sprite, width, height);
                        _structureTypes.Add(id, newStructure);
                    }
                }
            }
        }