Initial commit
This commit is contained in:
41
script/ShipLogic.gd
Normal file
41
script/ShipLogic.gd
Normal file
@@ -0,0 +1,41 @@
|
||||
extends MapLogic
|
||||
class_name ShipLogic
|
||||
|
||||
var roomList: Array[BasicRoom]
|
||||
var power: bool = true
|
||||
var hullBreached: bool = false
|
||||
const HULL_BREACHED_CONDITION_DROP_SPEED: float = 0.8
|
||||
var shipCondition: float = 100.0
|
||||
var shipFuel: float = 100.0
|
||||
|
||||
@export var controllRoom: ControlRoom
|
||||
@export var breakableRoom: CorridorDeadEndBreakable
|
||||
|
||||
func _process(delta: float) -> void:
|
||||
finishAstarSetup()
|
||||
|
||||
if Multiplayer.alivePlayerDict.size() == 0:
|
||||
looseMission()
|
||||
|
||||
|
||||
if hullBreached:
|
||||
shipCondition -= HULL_BREACHED_CONDITION_DROP_SPEED * delta
|
||||
updateShipConditionScreen()
|
||||
|
||||
func addRoomToRoomList(room: BasicRoom):
|
||||
roomList.push_back(room)
|
||||
|
||||
func updateLights():
|
||||
for room in roomList:
|
||||
room.showLights(power)
|
||||
|
||||
func collisionWithAstroid():
|
||||
onCollision.emit()
|
||||
hullBreached = true
|
||||
shipCondition -= 10
|
||||
if breakableRoom:
|
||||
breakableRoom.updateWallVisibility(false)
|
||||
|
||||
func updateShipConditionScreen():
|
||||
if controllRoom:
|
||||
controllRoom.shipConditionDisplayNumber = clamp(shipCondition + 1,0,100)
|
||||
Reference in New Issue
Block a user