Build validated industrial submarine cockpit
This commit is contained in:
1 parent
dffe790926
commit
fdebbafeae
19 files changed
+906
-277
No files matched your search
@@ -0,0 +1,102 @@
|
||||
class_name CockpitPracticalLighting
|
||||
extends Node3D
|
||||
|
||||
const DiveAlertLevel = preload("res://game/domain/dive/dive_alert_level.gd")
|
||||
const CockpitMaterialPalette = preload(
|
||||
"res://game/presentation/cockpit/cockpit_material_palette.gd"
|
||||
)
|
||||
const CockpitMeshFactory = preload(
|
||||
"res://game/presentation/cockpit/cockpit_mesh_factory.gd"
|
||||
)
|
||||
|
||||
var _materials: CockpitMaterialPalette
|
||||
var _warm_lights: Array[OmniLight3D] = []
|
||||
var _emergency_light: OmniLight3D
|
||||
|
||||
|
||||
func _init(materials: CockpitMaterialPalette) -> void:
|
||||
_materials = materials
|
||||
name = "PracticalLighting"
|
||||
_add_caged_lamp(-0.76, -8.0)
|
||||
_add_caged_lamp(0.76, 8.0)
|
||||
_add_fill_light()
|
||||
_add_emergency_light()
|
||||
|
||||
|
||||
func present(alert_level: DiveAlertLevel.Value) -> void:
|
||||
_emergency_light.visible = alert_level >= DiveAlertLevel.Value.CRITICAL
|
||||
for light: OmniLight3D in _warm_lights:
|
||||
light.light_energy = 0.22 if alert_level >= DiveAlertLevel.Value.CRITICAL else 0.48
|
||||
|
||||
|
||||
func practical_light_count() -> int:
|
||||
return _warm_lights.size()
|
||||
|
||||
|
||||
func _add_caged_lamp(x: float, roll_degrees: float) -> void:
|
||||
var root := Node3D.new()
|
||||
root.name = "CagedLamp"
|
||||
root.position = Vector3(x, 0.88, -1.16)
|
||||
root.rotation_degrees.z = roll_degrees
|
||||
add_child(root)
|
||||
CockpitMeshFactory.add_box(
|
||||
"LampHousing",
|
||||
root,
|
||||
Vector3(0.0, 0.0, -0.025),
|
||||
Vector3(0.14, 0.11, 0.055),
|
||||
_materials.dark_steel
|
||||
)
|
||||
CockpitMeshFactory.add_sphere(
|
||||
"WarmBulb",
|
||||
root,
|
||||
Vector3(0.0, 0.0, 0.04),
|
||||
0.038,
|
||||
_materials.warm_glass
|
||||
)
|
||||
for x_offset: float in [-0.048, -0.024, 0.0, 0.024, 0.048]:
|
||||
CockpitMeshFactory.add_box(
|
||||
"LampGuard",
|
||||
root,
|
||||
Vector3(x_offset, 0.0, 0.095),
|
||||
Vector3(0.007, 0.10, 0.007),
|
||||
_materials.brushed_steel
|
||||
)
|
||||
for y_offset: float in [-0.04, 0.04]:
|
||||
CockpitMeshFactory.add_box(
|
||||
"LampGuardRail",
|
||||
root,
|
||||
Vector3(0.0, y_offset, 0.095),
|
||||
Vector3(0.115, 0.007, 0.007),
|
||||
_materials.brushed_steel
|
||||
)
|
||||
var light := OmniLight3D.new()
|
||||
light.name = "WarmPracticalLight"
|
||||
light.position = Vector3(0.0, -0.03, 0.16)
|
||||
light.light_color = Color(1.0, 0.55, 0.26)
|
||||
light.light_energy = 0.48
|
||||
light.omni_range = 1.75
|
||||
light.shadow_enabled = false
|
||||
root.add_child(light)
|
||||
_warm_lights.append(light)
|
||||
|
||||
|
||||
func _add_fill_light() -> void:
|
||||
var cool_fill := OmniLight3D.new()
|
||||
cool_fill.name = "CoolRearFill"
|
||||
cool_fill.position = Vector3(0.0, 0.42, 0.35)
|
||||
cool_fill.light_color = Color(0.24, 0.46, 0.47)
|
||||
cool_fill.light_energy = 0.36
|
||||
cool_fill.omni_range = 3.0
|
||||
cool_fill.shadow_enabled = false
|
||||
add_child(cool_fill)
|
||||
|
||||
|
||||
func _add_emergency_light() -> void:
|
||||
_emergency_light = OmniLight3D.new()
|
||||
_emergency_light.name = "EmergencyLight"
|
||||
_emergency_light.position = Vector3(-0.58, 0.44, -0.83)
|
||||
_emergency_light.light_color = Color(1.0, 0.04, 0.015)
|
||||
_emergency_light.light_energy = 1.4
|
||||
_emergency_light.omni_range = 2.4
|
||||
_emergency_light.visible = false
|
||||
add_child(_emergency_light)
|
||||
Reference in new issue
Block a user