Пример #1
0
        public RoomAdapter(Room Information)
        {
            this.Information = Information;
            this.Units = new Dictionary<int, RoomUnit>();
            this.UnitLocker = new ReaderWriterLockSlim();
            this.UnitCounter = new SafeInteger(0, true);

            this.BlockNodes = new List<BlockNode>();

            foreach (TileNode Node in Information.Model.Nodes)
            {
                var Point = new Point(Node.IX, Node.IY);

                var State = Node.DeadTile ? BlockState.BLOCKED : BlockState.OPEN;

                if (Point == new Point(Information.Model.LocationDoorX, Information.Model.LocationDoorY))
                {
                    State = BlockState.OPEN_LAST_STEP;
                }

                var Block = new BlockNode(Point, Node.Height, State);

                this.BlockNodes.Add(Block);
            }
        }
Пример #2
0
        /// <summary>
        /// Tries to get an node.
        /// </summary>
        /// <param name="Block"></param>
        /// <param name="Nodes"></param>
        /// <param name="Node"></param>
        /// <returns></returns>
        public bool TryPopNode(Point Block, ICollection<BlockNode> Nodes, out BlockNode Node)
        {
            Node = null;

            foreach (var Item in Nodes)
            {
                if (Item.Point == Block)
                {
                    Node = Item;
                }
            }

            return Node != null;
        }