Exemple #1
0
        /// <summary>
        /// Returns item at given position.
        /// </summary>
        /// <param name="position">The position to get item for.</param>
        /// <returns>The requested item if found, otherwise null.</returns>
        public ISquareMapItemElement GetItem(Position position)
        {
            ISquareMapItemElement item = null;

            if (position.IsInBoundary(this.boundary))
            {
                lock (this.items)
                {
                    item = this.items[position];
                }
            }

            return item;
        }
Exemple #2
0
 /// <summary>
 /// Tries to get item at given position.
 /// </summary>
 /// <param name="position">The position to get item for.</param>
 /// <param name="item">The item instance.</param>
 /// <returns>True if retrieval was successful, otherwise false.</returns>
 public bool TryGetItem(Position position, out ISquareMapItemElement item)
 {
     item = null;
     return position.IsInBoundary(this.boundary) && this.items.TryGetValue(position, out item);
 }
Exemple #3
0
 /// <summary>
 /// Checks whether an item exists on given position at map.
 /// </summary>
 /// <param name="position">The position to check item exitance for.</param>
 /// <returns>True if item exists, otherwise false.</returns>
 public bool ContainsItem(Position position)
 {
     return position.IsInBoundary(this.boundary) && this.items.ContainsKey(position);
 }