Exemplo n.º 1
0
        /// <summary>Создаёт объект</summary>
        /// <param name="image">Изображение объекта</param>
        /// <param name="collision_type">Тип столкновения с данным объектом</param>
        protected DungeonObject(Bitmap image, DungeonObjectCollision collision_type)
            : base()
        {
            m_image            = image;
            m_size             = image.Size;
            m_collision_type   = collision_type;
            m_collision_size   = m_size;
            m_collision_offset = new Point(0, 0);

            DungeonLevel = null;
            m_location   = new DungeonPoint(0, 0);
            ObjectStatus = DungeonObjectStatus.CreatedNotAdded;
        }
Exemplo n.º 2
0
 /// <summary>Уничтожает объект (принудительно - даже если нельзя уничтожить)</summary>
 public void Destroy()
 {
     if (ObjectStatus == DungeonObjectStatus.AddedNotDestroyed)
     {
         ObjectStatus = DungeonObjectStatus.Destroyed;
     }
     m_collision_type = DungeonObjectCollision.NoCollision;
     if (this is DungeonItem)
     {
         if ((this as DungeonItem).Container != null)
         {
             (this as DungeonItem).Container.Remove(this as DungeonItem);
         }
     }
     if (DungeonLevel != null)
     {
         DungeonLevel.Remove(this);
     }
 }