Example #1
0
        public static void LoadObjectBank(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];
                        bool isInternal = bool.Parse(split[4]);
                        bool isInteractable = bool.Parse(split[5]);
                        int width = int.Parse(split[6]);
                        int height = int.Parse(split[7]);

                        ObjectType newObject = new ObjectType(id, name, description, sprite, isInternal, isInteractable, width, height);
                        _objectTypes.Add(id, newObject);
                    }
                }
            }
        }
Example #2
0
        private ObjectType _objectType; // What type of object this is

        #endregion Fields

        #region Constructors

        public GameObject(string id, string objectType, Vector2 tilePosition)
            : base()
        {
            ID = id;
            _objectType = ObjectManager.GetType(objectType);
            base.TilePosition = tilePosition; // Set the tile position of the entity
            base.Position = new Vector2(tilePosition.X * Constants.TILE_SIZE, tilePosition.Y * Constants.TILE_SIZE);

            OverwriteTiles();
        }