Exemplo n.º 1
0
        public void SendToRoom(int roomId, GSPacketIn pkg, int exceptId, int exceptGameId)
        {
            BaseRoom room = FindRoom(roomId);

            if (room != null)
            {
                if (exceptId != 0)
                {
                    GamePlayer player = WorldMgr.GetPlayerById(exceptId);
                    if (player != null)
                    {
                        if (player.GamePlayerId == exceptGameId)
                        {
                            room.SendToAll(pkg, player);
                        }
                        else
                        {
                            room.SendToAll(pkg);
                        }
                    }
                }
                else
                {
                    room.SendToAll(pkg);
                }
            }
        }
    public void SpawnPotions()
    {
        int mightSpawnPotion;

        int randX, randY;

        int whileCount = 0;

        for (int i = 0; i < roomsScript.roomsInPlay.Count; i++)
        {
            BaseRoom br = roomsScript.roomsInPlay[i];
            whileCount       = 0;
            mightSpawnPotion = Random.Range(0, potionRarity);
            if (mightSpawnPotion == 0)
            {
                do
                {
                    whileCount += 1;
                    randX       = Random.Range(0, br.width);
                    randY       = Random.Range(0, br.length);
                } while (br.GetRoomSectionArray()[randX, randY].hasTownsfolk == true && whileCount < 10);

                if (whileCount < 10)
                {
                    br.GetRoomSectionArray()[randX, randY].hasPotion = true;
                    Potion     p  = new Potion();
                    GameObject go = Instantiate(potionObject, br.GetRoomSectionArray()[randX, randY].position,
                                                br.GetRoomSectionArray()[randX, randY].rotation);

                    p.SetPotionObject(go);
                    potionList.Add(p);
                }
            }
        }
    }
Exemplo n.º 3
0
        public RoomGameplay(FreelancerGame g, GameSession session, string newBase, BaseRoom room = null, string virtualRoom = null) : base(g)
        {
            this.session = session;
            baseId       = newBase;
            currentBase  = g.GameData.GetBase(newBase);
            currentRoom  = room ?? currentBase.StartRoom;
            SwitchToRoom();
            var tophotspots = new List <BaseHotspot>();

            foreach (var hp in currentRoom.Hotspots)
            {
                if (TOP_IDS.Contains(hp.Name))
                {
                    tophotspots.Add(hp);
                }
            }
            hud = new Hud(g, tophotspots);
            hud.RoomMode();
            hud.OnEntered          += Hud_OnTextEntry;
            hud.OnManeuverSelected += Hud_OnManeuverSelected;
            this.virtualRoom        = virtualRoom;
            hud.SetManeuver(virtualRoom ?? currentRoom.Nickname);
            Game.Keyboard.TextInput += Game_TextInput;
            Game.Keyboard.KeyDown   += Keyboard_KeyDown;
            cursor = Game.ResourceManager.GetCursor("arrow");
        }
Exemplo n.º 4
0
    public override BaseLevelStructure GetStructure()
    {
        var r = new BaseRoom();

        r.Init(this);
        return(r);
    }
Exemplo n.º 5
0
        ///// <summary>
        ///// 从栈中获取或新建一个房间
        ///// </summary>
        ///// <returns></returns>
        //FightRoom GetEmptyRoom() {
        //    FightRoom room;
        //    if (roomStack.Count == 0) {
        //        Interlocked.Increment(ref index);
        //        room = new FightRoom(index);
        //        room.manager = this;
        //        return room;
        //    }

        //    if (roomStack.TryPop(out room)) {
        //        return room;
        //    }
        //    return null;
        //}

        protected override void InitRoom(BaseRoom r)
        {
            if (r is FightRoom)
            {
                (r as FightRoom).manager = this;
            }
        }
Exemplo n.º 6
0
        private bool DoesIntersects(Entity door, BaseRoom room)
        {
            int doorRadius = 10;
            var distX      = Math.Abs(door.Position.X - room.Position.X - room.Size.Width / 2);
            var distY      = Math.Abs(door.Position.Y - room.Position.Y - room.Size.Height / 2);

            if (distX > (room.Size.Width / 2 + doorRadius))
            {
                return(false);
            }
            if (distY > (room.Size.Height / 2 + doorRadius))
            {
                return(false);
            }

            if (distX <= (room.Size.Width / 2))
            {
                return(true);
            }
            if (distY <= (room.Size.Height / 2))
            {
                return(true);
            }

            var dx = distX - room.Size.Width / 2;
            var dy = distY - room.Size.Height / 2;

            return(dx * dx + dy * dy <= (doorRadius * doorRadius));
        }
Exemplo n.º 7
0
        public void RemoveAllRoom()
        {
            BaseRoom[] list = null;
            Dictionary <int, BaseRoom> rooms;

            Monitor.Enter(rooms = this.m_rooms);
            try
            {
                list = this.m_rooms.Values.ToArray <BaseRoom>();
                this.m_rooms.Clear();
            }
            finally
            {
                Monitor.Exit(rooms);
            }
            BaseRoom[] array = list;
            for (int i = 0; i < array.Length; i++)
            {
                BaseRoom rm = array[i];
                if (rm != null)
                {
                    if (rm.IsPlaying && rm.Game == null)
                    {
                        RoomMgr.CancelPickup(this, rm);
                        rm.RemoveAllPlayer();
                    }
                    else
                    {
                        rm.RemoveAllPlayer();
                        RoomMgr.StopProxyGame(rm);
                    }
                }
            }
        }
    public GameObject AddRoomToList(BaseRoom newRoom, int gridPositionX, int gridPositionY, int rotation)
    {
        newRoom.SetPosition(gridPositionX, gridPositionY, 0);
        //Debug.Log("Room Number: " + roomCount);

        int newX;
        int newY;

        //Debug.Log("room Width: " + newRoom.width + "room Length: " + newRoom.length);
        for (int x = 0; x < newRoom.width; x++)
        {
            for (int y = 0; y < newRoom.length; y++)
            {
                newX = x + gridPositionX;
                newY = y + gridPositionY;
                //Debug.Log("Room X: " + newX + " Room Y: " + newY);
                newRoom.roomPieces[x, y] = new RoomSection(newRoom, x + gridPositionX, y + gridPositionY, 0, newRoom.rot);

                //Debug.Log("room Piece X: " + newX + " Y: " + newY);
                gridMapScript.GetGridMap()[x + gridPositionX, y + gridPositionY] = newRoom.roomPieces[x, y];
                //Debug.Log("Room Piece X " + gridMapScript.GetGridMap()[x+gridPositionX, y + gridPositionY].coords[0]
                //   + " Room Piece Y " + gridMapScript.GetGridMap()[x+gridPositionX, y + gridPositionY].coords[1]);
            }
        }

        newRoom.Rotate(rotation);

        GameObject newRoomObject = Instantiate(newRoom.roomObject, newRoom.position,
                                               newRoom.rotation);

        roomCount += 1;
        roomsInPlay.Add(newRoom);

        return(newRoomObject);
    }
Exemplo n.º 9
0
        public RoomGameplay(FreelancerGame g, GameSession session, string newBase, BaseRoom room = null, string virtualRoom = null) : base(g)
        {
            this.session = session;
            baseId       = newBase;
            currentBase  = g.GameData.GetBase(newBase);
            currentRoom  = room ?? currentBase.StartRoom;
            currentRoom.InitForDisplay();
            SwitchToRoom();
            tophotspots = new List <BaseHotspot>();
            foreach (var hp in currentRoom.Hotspots)
            {
                if (TOP_IDS.Contains(hp.Name))
                {
                    tophotspots.Add(hp);
                }
            }
            var rm = virtualRoom ?? currentRoom.Nickname;

            SetActiveHotspot(rm);
            this.virtualRoom = virtualRoom;
            hud            = new ScriptedHud(new LuaAPI(this), false, Game);
            hud.OnEntered += Hud_OnTextEntry;
            hud.Init();
            Game.Keyboard.TextInput += Game_TextInput;
            Game.Keyboard.KeyDown   += Keyboard_KeyDown;
            cursor = Game.ResourceManager.GetCursor("arrow");
            FadeIn(0.8, 1.7);
        }
Exemplo n.º 10
0
        public static bool CanChangeStyle(BaseRoom game, GSPacketIn pkg)
        {
            FightRateInfo[] infos = FightRateMgr.GetAllFightRateInfo();
            bool            result;

            try
            {
                FightRateInfo[] array = infos;
                for (int i = 0; i < array.Length; i++)
                {
                    FightRateInfo info = array[i];
                    if (info.BeginDay.Year <= DateTime.Now.Year && DateTime.Now.Year <= info.EndDay.Year)
                    {
                        if (info.BeginDay.DayOfYear <= DateTime.Now.DayOfYear && DateTime.Now.DayOfYear <= info.EndDay.DayOfYear)
                        {
                            if (info.BeginTime.TimeOfDay <= DateTime.Now.TimeOfDay && DateTime.Now.TimeOfDay <= info.EndTime.TimeOfDay)
                            {
                                if (FightRateMgr.random.Next(1000000) < info.Rate)
                                {
                                    result = true;
                                    return(result);
                                }
                            }
                        }
                    }
                }
            }
            catch
            {
            }
            pkg.WriteBoolean(false);
            result = false;
            return(result);
        }
Exemplo n.º 11
0
        public void SendRemoveRoom(BaseRoom room)
        {
            GSPacketIn pkg = new GSPacketIn((int)eFightPackageType.ROOM_REMOVE);

            pkg.Parameter1 = room.RoomId;
            SendTCP(pkg);
        }
Exemplo n.º 12
0
        public void SendToRoom(int roomId, GSPacketIn pkg, int exceptId, int exceptGameId)
        {
            BaseRoom baseRoom = this.FindRoom(roomId);

            if (baseRoom != null)
            {
                if (exceptId != 0)
                {
                    GamePlayer playerById = WorldMgr.GetPlayerById(exceptId);
                    if (playerById != null)
                    {
                        if (playerById.GamePlayerId == exceptGameId)
                        {
                            baseRoom.SendToAll(pkg, playerById);
                            return;
                        }
                        baseRoom.SendToAll(pkg);
                        return;
                    }
                }
                else
                {
                    baseRoom.SendToAll(pkg);
                }
            }
        }
Exemplo n.º 13
0
        public void RemoveRoomImp(int roomId)
        {
            BaseRoom baseRoom = null;
            Dictionary <int, BaseRoom> rooms;

            Monitor.Enter(rooms = this.m_rooms);
            try
            {
                if (this.m_rooms.ContainsKey(roomId))
                {
                    baseRoom = this.m_rooms[roomId];
                    this.m_rooms.Remove(roomId);
                }
            }
            finally
            {
                Monitor.Exit(rooms);
            }
            if (baseRoom != null)
            {
                if (baseRoom.IsPlaying && baseRoom.Game == null)
                {
                    RoomMgr.CancelPickup(this, baseRoom);
                    return;
                }
                RoomMgr.StopProxyGame(baseRoom);
            }
        }
Exemplo n.º 14
0
    // Get a random room based on our chance rolls and return a random position within it
    private void GetNewTargetPosition()
    {
        if (gameObject == null)
        {
            return;
        }

        CancelIdle();

        BaseRoom room = GetRandomIdleRoom();

        if (room == null)
        {
            Debug.Log("ERROR! GetRandomIdleRoom() null room ref");
            return;
        }

        Vector3 randomPosition = room.GetRandomPoint();

        // Now ensure we get a valid navmesh position nearest to this point
        NavMeshHit hit;

        NavMesh.SamplePosition(randomPosition, out hit, 20f, 1);
        Vector3 finalPosition = hit.position;

        m_NavAgent.SetDestination(finalPosition);
    }
Exemplo n.º 15
0
        public void RemoveRoomImp(int roomId)
        {
            BaseRoom room = null;

            lock (m_rooms)
            {
                if (m_rooms.ContainsKey(roomId))
                {
                    room = m_rooms[roomId];
                    m_rooms.Remove(roomId);
                }
            }

            if (room != null)
            {
                if (room.IsPlaying && room.Game == null)
                {
                    RoomMgr.CancelPickup(this, room);
                }
                else
                {
                    RoomMgr.StopProxyGame(room);
                }
            }
        }
Exemplo n.º 16
0
        public RoomGameplay(FreelancerGame g, CGameSession session, string newBase, BaseRoom room = null, string virtualRoom = null) : base(g)
        {
            this.session = session;
            baseId       = newBase;
            currentBase  = g.GameData.GetBase(newBase);
            currentRoom  = room ?? currentBase.StartRoom;
            currentRoom.InitForDisplay();
            SwitchToRoom();
            tophotspots = new List <BaseHotspot>();
            foreach (var hp in currentRoom.Hotspots)
            {
                if (TOP_IDS.Contains(hp.Name))
                {
                    tophotspots.Add(hp);
                }
            }
            var rm = virtualRoom ?? currentRoom.Nickname;

            SetActiveHotspot(rm);
            this.virtualRoom = virtualRoom;
            ui         = new UiContext(Game, "baseside.xml");
            ui.GameApi = new BaseUiApi(this);
            ui.Start();
            Game.Keyboard.TextInput += Game_TextInput;
            Game.Keyboard.KeyDown   += Keyboard_KeyDown;
            cursor = Game.ResourceManager.GetCursor("arrow");
            FadeIn(0.8, 1.7);
        }
Exemplo n.º 17
0
 public void SendRemoveRoom(BaseRoom room)
 {
     this.SendTCP(new GSPacketIn(65)
     {
         Parameter1 = room.RoomId
     });
 }
Exemplo n.º 18
0
        public void Unlock()
        {
            BaseRoom room = _rooms.RoomPositions[KeyPadRoomPosition];

            room.RemoveItem(KeyPadLock.KeyPadName);
            _reset();
        }
Exemplo n.º 19
0
        protected override void OnOpen()
        {
            base.OnOpen();
            Logger.Instance.Log($"WebSocket Client Connected! ");

            string[] split = Context.RequestUri.AbsolutePath.Split('/');
            int      _id   = Convert.ToInt32(split[split.Length - 1]);

            if (split[split.Length - 2] == "room")
            {
                BaseRoom _room = RoomsController.GetRoomsList().FirstOrDefault(room => room.roomId == _id);
                if (_room != null)
                {
                    _room.OnOpenWebSocket();
                }
            }
            else if (split[split.Length - 2] == "channel")
            {
                RadioChannel _channel = RadioController.radioChannels.FirstOrDefault(channel => channel.channelId == _id);
                if (_channel != null)
                {
                    _channel.OnOpenWebSocket();
                }
            }
        }
Exemplo n.º 20
0
    private bool CanCreateRoom(BaseRoom baseRoom)
    {
        if (m_mazeGenerator.maze.HasCell(baseRoom.PivotW, baseRoom.PivotH) ||
            m_mazeGenerator.maze.HasCell(baseRoom.PivotW, baseRoom.PivotH + baseRoom.RoomHeight - 1) ||
            m_mazeGenerator.maze.HasCell(baseRoom.PivotW + baseRoom.RoomWidth - 1, baseRoom.PivotH) ||
            m_mazeGenerator.maze.HasCell(baseRoom.PivotW + baseRoom.RoomWidth - 1, baseRoom.PivotH + baseRoom.RoomHeight - 1))
        {
            return(false);
        }

        for (int h = baseRoom.PivotH - 1; h < baseRoom.PivotH + baseRoom.RoomHeight + 1; h++)
        {
            for (int w = baseRoom.PivotW - 1; w < baseRoom.PivotW + baseRoom.RoomWidth + 1; w++)
            {
                if (w == m_mazeGenerator.maze.Width || h == m_mazeGenerator.maze.Width ||
                    w < 0 || h < 0)
                {
                    return(false);
                }

                if (m_mazeGenerator.maze.HasCell(w, h))
                {
                    return(false);
                }
            }
        }

        return(true);
    }
Exemplo n.º 21
0
        public void RemoveRoomImp(int roomId, int fightRoomId)
        {
            BaseRoom room = null;
            Dictionary <int, BaseRoom> rooms;

            Monitor.Enter(rooms = this.m_rooms);
            try
            {
                if (this.m_rooms.ContainsKey(roomId) && this.m_rooms[roomId].FightRoomID == fightRoomId)
                {
                    room = this.m_rooms[roomId];
                    this.m_rooms.Remove(roomId);
                }
            }
            finally
            {
                Monitor.Exit(rooms);
            }
            if (room != null)
            {
                if (room.IsPlaying && room.Game == null)
                {
                    RoomMgr.CancelPickup(this, room);
                }
                else
                {
                    RoomMgr.StopProxyGame(room);
                }
            }
        }
    private bool ConnectToSomething(BaseRoom room, Vector2Int p)
    {
        List <Vector2Int> neighbours = new List <Vector2Int>();

        BaseRoom neighbourRoom = GetRoomAtPosition(p.x, p.y + 1);

        if (room.HasDoor(Door.Up) && neighbourRoom != null && neighbourRoom.HasDoor(Door.Down))
        {
            neighbours.Add(Vector2Int.up);
        }

        neighbourRoom = GetRoomAtPosition(p.x, p.y - 1);
        if (room.HasDoor(Door.Down) && neighbourRoom != null && neighbourRoom.HasDoor(Door.Up))
        {
            neighbours.Add(Vector2Int.down);
        }

        neighbourRoom = GetRoomAtPosition(p.x + 1, p.y);
        if (room.HasDoor(Door.Right) && neighbourRoom != null && neighbourRoom.HasDoor(Door.Left))
        {
            neighbours.Add(Vector2Int.right);
        }

        neighbourRoom = GetRoomAtPosition(p.x - 1, p.y);
        if (room.HasDoor(Door.Left) && neighbourRoom != null && neighbourRoom.HasDoor(Door.Right))
        {
            neighbours.Add(Vector2Int.left);
        }

        if (neighbours.Count == 0)
        {
            return(false);
        }

        Vector2Int selectedDirection = neighbours[Random.Range(0, neighbours.Count)];
        BaseRoom   selectedRoom      = GetRoomAtPosition(p.x + selectedDirection.x, p.y + selectedDirection.y);

        if (selectedDirection == Vector2Int.up)
        {
            room.SetDoorState(Door.Up, false);
            selectedRoom.SetDoorState(Door.Down, false);
        }
        else if (selectedDirection == Vector2Int.down)
        {
            room.SetDoorState(Door.Down, false);
            selectedRoom.SetDoorState(Door.Up, false);
        }
        else if (selectedDirection == Vector2Int.right)
        {
            room.SetDoorState(Door.Right, false);
            selectedRoom.SetDoorState(Door.Left, false);
        }
        else if (selectedDirection == Vector2Int.left)
        {
            room.SetDoorState(Door.Left, false);
            selectedRoom.SetDoorState(Door.Right, false);
        }

        return(true);
    }
        private void PlayerOnRoomChange(BaseRoom room)
        {
            LeftStick.SetActive(false);
            XButton.SetActive(false);
            OButton.SetActive(false);
            RapaireButton.SetActive(false);

            if (room == null)
            {
                return;
            }

            if (room.CurrentHealth < room.MaxHealth)
            {
                RapaireButton.SetActive(true);
                return;
            }

            if (room.IsLocked)
            {
                foreach (var key in room.HelperActiveKeys)
                {
                    if (key == ControllHelperKey.LeftStick)
                    {
                        LeftStick.SetActive(true);
                    }

                    if (key == ControllHelperKey.ButtonX)
                    {
                        XButton.SetActive(true);
                    }

                    if (key == ControllHelperKey.ButtonO)
                    {
                        OButton.SetActive(true);
                    }
                }
            }
            else
            {
                foreach (var key in room.HelperInactiveKeys)
                {
                    if (key == ControllHelperKey.LeftStick)
                    {
                        LeftStick.SetActive(true);
                    }

                    if (key == ControllHelperKey.ButtonX)
                    {
                        XButton.SetActive(true);
                    }

                    if (key == ControllHelperKey.ButtonO)
                    {
                        OButton.SetActive(true);
                    }
                }
            }
        }
Exemplo n.º 24
0
        public void SendChangeGameType(BaseRoom room)
        {
            GSPacketIn pkg = new GSPacketIn(72);

            pkg.Parameter1 = room.RoomId;
            pkg.WriteInt((int)room.GameType);
            this.SendTCP(pkg);
        }
Exemplo n.º 25
0
 public BaseRoom(BaseRoom br)
 {
     width      = br.width;
     length     = br.length;
     roomObject = br.roomObject;
     roomSize   = br.roomSize;
     roomPieces = new RoomSection[width, length];
 }
Exemplo n.º 26
0
 public static void AddRoom(BaseRoom room)
 {
     if (Server != null && Settings.Instance.Server.EnableWebSocketRoomInfo)
     {
         Server.AddWebSocketService <Broadcast>($"/room/{room.roomId}");
         BroadcastState();
     }
 }
Exemplo n.º 27
0
 public static void DestroyRoom(BaseRoom room)
 {
     if (Server != null && Settings.Instance.Server.EnableWebSocketRoomInfo)
     {
         Server.RemoveWebSocketService($"/room/{room.roomId}");
         BroadcastState();
     }
 }
Exemplo n.º 28
0
        public static bool CanChangeStyle(BaseRoom game, GSPacketIn pkg)
        {
            FightRateInfo[] infos = GetAllFightRateInfo();
            try
            {
                foreach (FightRateInfo info in infos)
                {
                    if (info.BeginDay.Year <= DateTime.Now.Year && DateTime.Now.Year <= info.EndDay.Year)
                    {
                        if (info.BeginDay.DayOfYear <= DateTime.Now.DayOfYear && DateTime.Now.DayOfYear <= info.EndDay.DayOfYear)
                        {
                            if (info.BeginTime.TimeOfDay <= DateTime.Now.TimeOfDay && DateTime.Now.TimeOfDay <= info.EndTime.TimeOfDay)
                            {
                                if (Bussiness.ThreadSafeRandom.NextStatic(1000000) < info.Rate)
                                {
                                    //game.Data.FightName = info.Name;
                                    //GamePlayer[] selfs = game.GetAllPlayers();

                                    //pkg.WriteBoolean(true);
                                    //pkg.WriteInt(selfs.Length);
                                    //foreach (GamePlayer p in selfs)
                                    //{
                                    //    string style = string.Empty;
                                    //    string color = string.Empty;
                                    //    string skin = string.Empty;
                                    //    p.CurrentInventory.GetStyle(11, p.PlayerCharacter.Sex ? info.BoyTemplateID : info.GirlTemplateID, ref style, ref color, ref skin);

                                    //    //p.UpdateStyle(style,color,skin, p.EquipShow(3, 1, p.PlayerCharacter.Hide), true);
                                    //    pkg.WriteInt(p.PlayerCharacter.ID);
                                    //    pkg.WriteString(style);
                                    //    pkg.WriteInt(p.EquipShow(3, 1, p.PlayerCharacter.Hide));
                                    //    pkg.WriteBoolean(p.PlayerCharacter.Sex);
                                    //    pkg.WriteString(skin);
                                    //    pkg.WriteString(color);

                                    //    p.Out.SendMessage(Game.Server.Packets.eMessageType.ChatNormal, info.SelfCue);
                                    //}

                                    //GamePlayer[] enemys = game.MatchGame.GetAllPlayers();
                                    //foreach (GamePlayer p in enemys)
                                    //{
                                    //    p.Out.SendMessage(Game.Server.Packets.eMessageType.ChatNormal, info.EnemyCue);
                                    //}

                                    return(true);
                                }
                            }
                        }
                    }
                }
            }
            catch
            { }

            pkg.WriteBoolean(false);

            return(false);
        }
Exemplo n.º 29
0
    /// <summary>
    /// Removes the room from the overall dictionary, sets all door parents and destroys the room object
    /// </summary>
    /// <param name="room">Room to destroy</param>
    /// <param name="roomId">Unique ID of the room</param>
    private void HandleRoomDespawning(BaseRoom room, Guid roomId)
    {
        // Remove the room from overall dictionary
        roomDictionary.Remove(roomId);

        Dictionary <Vector2, RoomDoor>  roomDoors        = room.roomDoors;
        Dictionary <RoomDoor, BaseRoom> neighboringRooms = new Dictionary <RoomDoor, BaseRoom>();

        // Enumerate through the room's doors
        foreach (KeyValuePair <Vector2, RoomDoor> kvp in roomDoors)
        {
            RoomDoor door = kvp.Value;

            Vector2 doorExit = room.GetDoorExit(door);

            // Skip doors that don't have another room connected
            if (!roomLocations.ContainsKey(doorExit))
            {
                continue;
            }

            BaseRoom exitRoom = roomLocations[doorExit];

            neighboringRooms.Add(door, exitRoom);
        }

        // Enumerate through all doors
        foreach (KeyValuePair <RoomDoor, BaseRoom> kvp in neighboringRooms)
        {
            BaseRoom neighboringRoom = kvp.Value;

            if (neighboringRoom == null)
            {
                continue;
            }

            RoomDoor currentDoor = kvp.Key;

            Vector2 setLocation = currentDoor.GetLocation();

            // Change connected door's parent to their other connected room so they don't get destroyed
            currentDoor.transform.SetParent(neighboringRoom.transform);
        }

        // Loop through all the tile locations for the room to be destroyed
        for (int i = 0; i < room.roomLocations.Count; ++i)
        {
            Vector2 location = room.roomLocations[i];
            if (roomLocations.ContainsKey(location))
            {
                // Remove the tile location from the overall used locations
                roomLocations.Remove(location);
            }
        }

        // Finally destroy the room object
        Destroy(room.gameObject);
    }
Exemplo n.º 30
0
 /// <summary>
 /// Instantiates an OrgRoom object
 /// </summary>
 /// <param name="Name">User controlled Room Name</param>
 /// <param name="Room">Type of BaseRoom object to determine base stats</param>
 /// <param name="Augmentations">List of BaseRoom_Augmentations to apply to the base room</param>
 /// <param name="Notes">User controlled room notes</param>
 /// <param name="ActiveResource">Resource this room is currently generating</param>
 public OrgRoom(String Name, BaseRoom Room, List<BaseRoom_Augmentation> Augmentations, String Notes, BaseResource ActiveResource)
 {
     this.Name = Name;
     this.Room = Room;
     this.Augmentations.Clear();
     this.Augmentations.AddRange(Augmentations);
     this.Notes = Notes;
     this.ActiveResource = ActiveResource;
 }
Exemplo n.º 31
0
        public void StartGame(int roomId, ProxyGame game)
        {
            BaseRoom room = FindRoom(roomId);

            if (room != null)
            {
                RoomMgr.StartProxyGame(room, game);
            }
        }