Esempio n. 1
0
        internal bool AddItemToMap(RoomItem Item, bool handleGameItem)
        {
            if (handleGameItem)
            {
                if (room.GotWired() && WiredUtillity.TypeIsWired(Item.GetBaseItem().InteractionType))
                {
                    room.GetWiredHandler().AddFurniture(Item);
                }

                AddSpecialItems(Item);

                switch (Item.GetBaseItem().InteractionType)
                {
                case InteractionType.footballgoalred:
                case InteractionType.footballcounterred:
                case InteractionType.banzaiscorered:
                case InteractionType.freezeredcounter:
                case InteractionType.freezeredgate:
                {
                    room.GetGameManager().AddFurnitureToTeam(Item, Games.Team.red);
                    break;
                }

                case InteractionType.footballgoalgreen:
                case InteractionType.footballcountergreen:
                case InteractionType.banzaiscoregreen:
                case InteractionType.freezegreencounter:
                case InteractionType.freezegreengate:
                {
                    room.GetGameManager().AddFurnitureToTeam(Item, Games.Team.green);
                    break;
                }

                case InteractionType.footballgoalblue:
                case InteractionType.footballcounterblue:
                case InteractionType.banzaiscoreblue:
                case InteractionType.freezebluecounter:
                case InteractionType.freezebluegate:
                {
                    room.GetGameManager().AddFurnitureToTeam(Item, Games.Team.blue);
                    break;
                }

                case InteractionType.footballgoalyellow:
                case InteractionType.footballcounteryellow:
                case InteractionType.banzaiscoreyellow:
                case InteractionType.freezeyellowcounter:
                case InteractionType.freezeyellowgate:
                {
                    room.GetGameManager().AddFurnitureToTeam(Item, Games.Team.yellow);
                    break;
                }

                case InteractionType.freezeexit:
                {
                    room.GetFreeze().ExitTeleport = Item;
                    break;
                }

                case InteractionType.roller:
                {
                    if (!room.GetRoomItemHandler().mRollers.ContainsKey(Item.Id))
                    {
                        room.GetRoomItemHandler().mRollers.Add(Item.Id, Item);
                    }
                    break;
                }
                }
            }

            if (Item.GetBaseItem().Type != 's')
            {
                return(true);
            }

            foreach (Point coord in Item.GetCoords)
            {
                Point point = new Point(coord.X, coord.Y);
                AddCoordinatedItem(Item, point);
            }

            if (Item.GetX > (Model.MapSizeX - 1))
            {
                Model.AddX();
                GenerateMaps();
                return(false);
            }

            if (Item.GetY > (Model.MapSizeY - 1))
            {
                Model.AddY();
                GenerateMaps();
                return(false);
            }


            foreach (Point coord in Item.GetCoords)
            {
                if (!ConstructMapForItem(Item, coord))
                {
                    return(false);
                }
            }

            return(true);
        }