Beispiel #1
0
    public void SetActiveRoom(RoomController room_controller, bool set_focus = true)
    {
        if (room_controller != active)
        {
            if (active)
            {
                active.Deactivate();
            }
            active = room_controller;
            active.Activate();
            if (set_focus)
            {
                UIHandler.FocusRoom(room_controller);
            }
            if (active != null && loaded_backgrounds != null)
            {
                foreach (GameObject go in loaded_backgrounds)
                {
                    go.transform.position = active.transform.position + new Vector3(active.room.size.x * Room.Section.width, active.room.size.y * Room.Section.height, 0) / 2f;
                }

                on_enter_room?.Invoke(active, !discovered_rooms.Contains(active));
                discovered_rooms.Add(active);
            }
        }
    }