Exemplo n.º 1
0
 /// <summary>
 /// Remove an item
 /// </summary>
 /// <param name="item"></param>
 /// <exception cref="Exception"></exception>
 public void Remove(T item)
 {
     if (!Items.Remove(item))
     {
         ExceptionLogger.Exception($"Tried to get remove {typeof(T)} but the object does not exist on the board");
     }
 }
        /// <inheritdoc />
        public SaveGame.SaveData Load(string fileName)
        {
            if (!Exists(fileName))
            {
                ExceptionLogger.Exception("Tried to load save file that did not exist");
            }

            return(JsonUtility.FromJson <SaveGame.SaveData>(System.IO.File.ReadAllText(fileName)));
        }
Exemplo n.º 3
0
        public void Add(IActor actor)
        {
            if (_static.Contains(actor.Position))
            {
                ExceptionLogger.Exception($"Tried to add an actor {actor} at a position where a wall exists ({actor.Position})");
            }

            _actors.Add(actor);
        }
Exemplo n.º 4
0
        /// <summary>
        /// Remove an item at a position
        /// </summary>
        /// <param name="at"></param>
        /// <exception cref="Exception"></exception>
        public void Remove(Vector2Int at)
        {
            var item = Get(at);

            if (item == null)
            {
                ExceptionLogger.Exception($"Tried to remove item at {at} but no item exists in this position");
            }

            Items.Remove(item);
        }
Exemplo n.º 5
0
        /// <summary>
        /// Add a new item
        /// </summary>
        /// <param name="item"></param>
        /// <exception cref="Exception"></exception>
        public void Add(T item)
        {
            if (Exists(item))
            {
                ExceptionLogger.Exception($"Tried to add same item of type {typeof(T)} to the registry twice!");
            }

            if (Exists(item.Position))
            {
                ExceptionLogger.Exception($"Tried to add {typeof(T)} at position where one already exists ({item.Position})");
            }

            Items.Add(item);
        }