48 lines
1.3 KiB
GDScript
48 lines
1.3 KiB
GDScript
# CameraSystem.gd
|
|
extends Node
|
|
class_name CameraManager
|
|
|
|
@export var display: TextureRect
|
|
var current_room: Room
|
|
@export var rooms: Array[Room] = []
|
|
|
|
func select_room(room_id: Global.LocationID):
|
|
for room in rooms:
|
|
print(room, room.room_id)
|
|
print("Comparing room id: ", room.room_id, " With: ", room_id)
|
|
if room.room_id == room_id:
|
|
current_room = room
|
|
break
|
|
|
|
func force_room(index: int):
|
|
if index >= 0 and index < rooms.size():
|
|
current_room = rooms[index]
|
|
else:
|
|
print("force_room: invalid index ", index)
|
|
|
|
func _process(_delta):
|
|
if current_room == null:
|
|
current_room = rooms[0]
|
|
if current_room:
|
|
current_room._process(_delta)
|
|
display.texture = current_room.getTexture()
|
|
|
|
|
|
func _on_cam_pressed(id:int) -> void:
|
|
print("Camera Change with: ", id)
|
|
force_room(id)
|
|
return
|
|
var eRoom: Global.LocationID
|
|
match id:
|
|
0: eRoom = Global.LocationID.POWER_STATION
|
|
1: eRoom = Global.LocationID.DINING_AREA
|
|
2: eRoom = Global.LocationID.WEST_HALL
|
|
3: eRoom = Global.LocationID.EAST_HALL
|
|
4: eRoom = Global.LocationID.SUPPLY_CLOSET
|
|
5: eRoom = Global.LocationID.BACKSTAGE
|
|
6: eRoom = Global.LocationID.LIVING_AREA
|
|
7: eRoom = Global.LocationID.OFFICE_LEFT_DOOR
|
|
8: eRoom = Global.LocationID.OFFICE_RIGHT_DOOR
|
|
9: eRoom = Global.LocationID.OFFICE
|
|
select_room(eRoom)
|