Ejemplo n.º 1
0
        public bool AddItemToMap(Item Item, bool handleGameItem, bool NewItem = true)
        {
            if (handleGameItem)
            {
                AddSpecialItems(Item);
                switch (Item.GetBaseItem().InteractionType)
                {
                case InteractionType.FootballGoalRed:
                case InteractionType.Footballcounterred:
                case InteractionType.Banzaiscorered:
                case InteractionType.Banzaigatered:
                case InteractionType.Freezeredcounter:
                case InteractionType.FreezeRedGate:
                {
                    if (!_room.GetRoomItemHandler().GetFloor.Contains(Item))
                    {
                        _room.GetGameManager().AddFurnitureToTeam(Item, TEAM.RED);
                    }
                    break;
                }

                case InteractionType.FootballGoalGreen:
                case InteractionType.Footballcountergreen:
                case InteractionType.Banzaiscoregreen:
                case InteractionType.Banzaigategreen:
                case InteractionType.Freezegreencounter:
                case InteractionType.FreezeGreenGate:
                {
                    if (!_room.GetRoomItemHandler().GetFloor.Contains(Item))
                    {
                        _room.GetGameManager().AddFurnitureToTeam(Item, TEAM.GREEN);
                    }
                    break;
                }

                case InteractionType.FootballGoalBlue:
                case InteractionType.Footballcounterblue:
                case InteractionType.Banzaiscoreblue:
                case InteractionType.Banzaigateblue:
                case InteractionType.Freezebluecounter:
                case InteractionType.FreezeBlueGate:
                {
                    if (!_room.GetRoomItemHandler().GetFloor.Contains(Item))
                    {
                        _room.GetGameManager().AddFurnitureToTeam(Item, TEAM.BLUE);
                    }
                    break;
                }

                case InteractionType.FootballGoalYellow:
                case InteractionType.Footballcounteryellow:
                case InteractionType.Banzaiscoreyellow:
                case InteractionType.Banzaigateyellow:
                case InteractionType.Freezeyellowcounter:
                case InteractionType.FreezeYellowGate:
                {
                    if (!_room.GetRoomItemHandler().GetFloor.Contains(Item))
                    {
                        _room.GetGameManager().AddFurnitureToTeam(Item, TEAM.YELLOW);
                    }
                    break;
                }

                case InteractionType.Freezeexit:
                {
                    _room.GetFreeze().AddExitTile(Item);
                    break;
                }

                case InteractionType.Roller:
                {
                    if (!_room.GetRoomItemHandler().GetRollers().Contains(Item))
                    {
                        _room.GetRoomItemHandler().TryAddRoller(Item.Id, Item);
                    }
                    break;
                }
                }
            }

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

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

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

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

            var Return = true;

            foreach (var coord in Item.GetCoords)
            {
                if (!ConstructMapForItem(Item, coord))
                {
                    Return = false;
                }
                else
                {
                    Return = true;
                }
            }

            return(Return);
        }
Ejemplo n.º 2
0
        public bool AddItemToMap(Item Item, bool handleGameItem, bool NewItem = true)
        {
            if (handleGameItem)
            {
                AddSpecialItems(Item);

                switch (Item.GetBaseItem().InteractionType)
                {
                case InteractionType.FOOTBALL_GOAL_RED:
                case InteractionType.footballcounterred:
                case InteractionType.banzaiscorered:
                case InteractionType.banzaigatered:
                case InteractionType.freezeredcounter:
                case InteractionType.FREEZE_RED_GATE:
                {
                    if (!_room.GetRoomItemHandler().GetFloor.Contains(Item))
                    {
                        _room.GetGameManager().AddFurnitureToTeam(Item, Team.Red);
                    }
                    break;
                }

                case InteractionType.FOOTBALL_GOAL_GREEN:
                case InteractionType.footballcountergreen:
                case InteractionType.banzaiscoregreen:
                case InteractionType.banzaigategreen:
                case InteractionType.freezegreencounter:
                case InteractionType.FREEZE_GREEN_GATE:
                {
                    if (!_room.GetRoomItemHandler().GetFloor.Contains(Item))
                    {
                        _room.GetGameManager().AddFurnitureToTeam(Item, Team.Green);
                    }
                    break;
                }

                case InteractionType.FOOTBALL_GOAL_BLUE:
                case InteractionType.footballcounterblue:
                case InteractionType.banzaiscoreblue:
                case InteractionType.banzaigateblue:
                case InteractionType.freezebluecounter:
                case InteractionType.FREEZE_BLUE_GATE:
                {
                    if (!_room.GetRoomItemHandler().GetFloor.Contains(Item))
                    {
                        _room.GetGameManager().AddFurnitureToTeam(Item, Team.Blue);
                    }
                    break;
                }

                case InteractionType.FOOTBALL_GOAL_YELLOW:
                case InteractionType.footballcounteryellow:
                case InteractionType.banzaiscoreyellow:
                case InteractionType.banzaigateyellow:
                case InteractionType.freezeyellowcounter:
                case InteractionType.FREEZE_YELLOW_GATE:
                {
                    if (!_room.GetRoomItemHandler().GetFloor.Contains(Item))
                    {
                        _room.GetGameManager().AddFurnitureToTeam(Item, Team.Yellow);
                    }
                    break;
                }

                case InteractionType.freezeexit:
                {
                    _room.GetFreeze().AddExitTile(Item);
                    break;
                }

                case InteractionType.ROLLER:
                {
                    if (!_room.GetRoomItemHandler().GetRollers().Contains(Item))
                    {
                        _room.GetRoomItemHandler().TryAddRoller(Item.Id, Item);
                    }
                    break;
                }
                }
            }

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

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

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

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

            bool Return = true;

            foreach (Point coord in Item.GetCoords)
            {
                if (!ConstructMapForItem(Item, coord))
                {
                    Return = false;
                }
                else
                {
                    Return = true;
                }
            }



            return(Return);
        }