Example #1
0
        /// <summary>
        /// Удаляет сущность.
        /// </summary>
        /// <param name="key">Ключ, идентифицирующий значение.</param>
        /// <returns>True если удалено.</returns>
        public bool Remove(int x, int y)
        {
            GridObject tmp = new GridObject();

            tmp.SetCoordinate(x, y);
            foreach (GridObject cur in this.objectTable.Keys)
            {
                if (tmp.Equals(cur as object))
                {
                    return(objectTable.Remove(cur));
                }
            }
            return(false);
        }
Example #2
0
 public bool ContainsKey(int x, int y)
 {
     using (GridObject tmp = new GridObject())
     {
         tmp.SetCoordinate(x, y);
         foreach (GridObject cur in this.objectTable.Keys)
         {
             if (tmp.Equals(cur as object))
             {
                 return(true);
             }
         }
         return(false);
     }
 }
Example #3
0
        /// <summary>
        /// получает значение в  (x,y).
        /// </summary>
        /// <param name="index">Координаты.</param>
        /// <returns>Значение.</returns>
        public GridObject this[int x, int y]
        {
            get
            {
                using (GridObject tmp = new GridObject())
                {
                    tmp.SetCoordinate(x, y);

                    foreach (GridObject cur in this.objectTable.Keys)
                    {
                        if (tmp.Equals(cur as object))
                        {
                            return(objectTable[cur]);
                        }
                    }
                    return(null);
                }
            }
        }