edit special power up
This commit is contained in:
+1
-50
@@ -6,7 +6,6 @@ extends Node3D
|
||||
|
||||
# Manager references
|
||||
var ui_manager
|
||||
var obstacle_manager
|
||||
var goals_cycle_manager
|
||||
var screen_shake_manager
|
||||
var touch_controls
|
||||
@@ -31,7 +30,6 @@ func _ready():
|
||||
ui_manager.setup_timer_labels(self)
|
||||
ui_manager.setup_leaderboard_ui(self)
|
||||
ui_manager.setup_powerup_bar_ui(self)
|
||||
_setup_obstacle_ui()
|
||||
# GlobalMatchTimer is now static in main.tscn - no setup needed
|
||||
# NetworkPanel is visible during gameplay
|
||||
|
||||
@@ -48,11 +46,6 @@ func _init_managers():
|
||||
add_child(ui_manager)
|
||||
ui_manager.initialize(self)
|
||||
|
||||
obstacle_manager = load("res://scripts/managers/obstacle_manager.gd").new()
|
||||
obstacle_manager.name = "ObstacleManager"
|
||||
add_child(obstacle_manager)
|
||||
obstacle_manager.initialize($EnhancedGridMap)
|
||||
|
||||
# Goals cycle manager for 60-second timer and scoring
|
||||
goals_cycle_manager = load("res://scripts/managers/goals_cycle_manager.gd").new()
|
||||
goals_cycle_manager.name = "GoalsCycleManager"
|
||||
@@ -184,25 +177,6 @@ func add_message_to_bar(player_name: String, message: String, type: int = Messag
|
||||
func broadcast_message(player_name: String, message: String):
|
||||
add_message_to_bar(player_name, message)
|
||||
|
||||
func _setup_obstacle_ui():
|
||||
var obstacle_button = Button.new()
|
||||
obstacle_button.text = "Place Obstacle"
|
||||
obstacle_button.pressed.connect(func(): _set_action_state(ui_manager.ActionState.PLACING_OBSTACLE))
|
||||
$ActionMenu/ActionButtonContainer.add_child(obstacle_button)
|
||||
|
||||
var orientation_button = Button.new()
|
||||
orientation_button.text = "Direction: North"
|
||||
orientation_button.pressed.connect(func():
|
||||
orientation_button.text = obstacle_manager.cycle_obstacle_orientation()
|
||||
)
|
||||
$ActionMenu/ActionButtonContainer.add_child(orientation_button)
|
||||
|
||||
var type_button = Button.new()
|
||||
type_button.text = "Type: 1"
|
||||
type_button.pressed.connect(func():
|
||||
type_button.text = obstacle_manager.cycle_obstacle_type()
|
||||
)
|
||||
$ActionMenu/ActionButtonContainer.add_child(type_button)
|
||||
|
||||
func _setup_global_match_timer_ui():
|
||||
"""Create the global match timer display at the top of the screen."""
|
||||
@@ -608,8 +582,7 @@ func _set_action_state(new_state):
|
||||
ui_manager.ActionState.ARRANGING:
|
||||
_show_arrangement_ui()
|
||||
local_player.highlight_occupied_playerboard_slots()
|
||||
ui_manager.ActionState.PLACING_OBSTACLE:
|
||||
local_player.highlight_valid_obstacle_cells()
|
||||
|
||||
|
||||
func _show_arrangement_ui():
|
||||
if ui_manager.playerboard_ui:
|
||||
@@ -626,28 +599,6 @@ func _on_playerboard_slot_clicked(event, slot_index):
|
||||
ui_manager.ActionState.ARRANGING:
|
||||
local_player.arrange_playerboard_item(slot_index)
|
||||
|
||||
# =============================================================================
|
||||
# Obstacle Management
|
||||
# =============================================================================
|
||||
|
||||
func place_obstacle(grid_position: Vector2i) -> bool:
|
||||
var local_player = GameStateManager.local_player_character
|
||||
var success = obstacle_manager.place_obstacle(grid_position, local_player)
|
||||
|
||||
if success:
|
||||
local_player.clear_highlights()
|
||||
_set_action_state(ui_manager.ActionState.NONE)
|
||||
|
||||
if is_multiplayer_authority():
|
||||
rpc("sync_place_obstacle", grid_position.x, grid_position.y, 3,
|
||||
obstacle_manager.current_obstacle_item, obstacle_manager.current_obstacle_orientation)
|
||||
|
||||
return success
|
||||
|
||||
@rpc("any_peer", "call_local")
|
||||
func sync_place_obstacle(x: int, y: int, floor_index: int, item_index: int, orientation: int):
|
||||
$EnhancedGridMap.place_obstacle(Vector3i(x, floor_index, y), item_index, orientation)
|
||||
|
||||
# =============================================================================
|
||||
# Goal & Playerboard Sync
|
||||
# =============================================================================
|
||||
|
||||
@@ -59,7 +59,6 @@ script = ExtResource("2_hbe1v")
|
||||
columns = 14
|
||||
rows = 14
|
||||
floors = 2
|
||||
obstacle_items = Array[int]([12])
|
||||
metadata/_editor_floor_ = Vector3(0, 1, 0)
|
||||
|
||||
[node name="Camera3D" type="Camera3D" parent="."]
|
||||
|
||||
+49
-2
@@ -549,6 +549,55 @@ func sync_display_name(new_name: String) -> void:
|
||||
"""Sync display name across network."""
|
||||
display_name = new_name
|
||||
$Name.text = display_name
|
||||
|
||||
@rpc("any_peer", "call_local", "reliable")
|
||||
func sync_modulate(color: Color) -> void:
|
||||
"""Sync visual modulation (e.g. freeze effect) across network."""
|
||||
# Node3D doesn't have modulate. We must tint the active character meshes.
|
||||
var active_char_node = null
|
||||
|
||||
match selected_character:
|
||||
"Bob": active_char_node = character_bob
|
||||
"Masbro": active_char_node = character_masbro
|
||||
"Gatot": active_char_node = character_gatot
|
||||
"Oldpop": active_char_node = character_oldpop
|
||||
|
||||
if active_char_node:
|
||||
_apply_tint_recursive(active_char_node, color)
|
||||
|
||||
func _apply_tint_recursive(node: Node, color: Color):
|
||||
if node is MeshInstance3D:
|
||||
# Simple way to tint: use material_overlay with an unshaded material if possible,
|
||||
# or transparency. But changing albedo on shared materials affects all instances!
|
||||
# Using transparency/modulate equivalent in 3D is tricky without unique materials.
|
||||
# A common trick is to use `instance_shader_parameter` if supported, or modifying visibility range? No.
|
||||
# Best safe visual cue for "Help me create an ice effect" without shaders:
|
||||
# Set `transparency` (alpha) if we want ghost, or `material_overlay`.
|
||||
# For this quick fix, let's create a standard material overlay on the fly if needed
|
||||
# or just rely on a debug geometry.
|
||||
# Actually, geometry_instance_3d has `material_overlay`.
|
||||
# Better approach for "Freeze": Just add a visible "Ice Block" mesh to the player
|
||||
# instead of trying to tint the gltf model which might have complex materials.
|
||||
# But user asked for "modulate". The closest 3D equivalent is material_overlay with a color.
|
||||
var mat = StandardMaterial3D.new()
|
||||
mat.albedo_color = color
|
||||
mat.blend_mode = BaseMaterial3D.BLEND_MODE_MIX
|
||||
mat.cull_mode = BaseMaterial3D.CULL_DISABLED
|
||||
mat.shading_mode = BaseMaterial3D.SHADING_MODE_UNSHADED
|
||||
|
||||
# If color is WHITE (reset), clear the overlay
|
||||
if color == Color.WHITE:
|
||||
node.material_overlay = null
|
||||
else:
|
||||
# If color is Blue (frozen), make it semi-transparent overlay
|
||||
mat.albedo_color = color
|
||||
mat.albedo_color.a = 0.5 # Semi-transparent
|
||||
mat.transparency = BaseMaterial3D.TRANSPARENCY_ALPHA
|
||||
node.material_overlay = mat
|
||||
|
||||
for child in node.get_children():
|
||||
_apply_tint_recursive(child, color)
|
||||
|
||||
|
||||
func _process(delta):
|
||||
if is_multiplayer_authority():
|
||||
@@ -1354,8 +1403,6 @@ func set_spawn_position(pos: Vector2i):
|
||||
current_position.y * cell_size.z + cell_size.z * 0.5
|
||||
) + cell_offset
|
||||
|
||||
func highlight_valid_obstacle_cells():
|
||||
action_manager.highlight_valid_obstacle_cells()
|
||||
|
||||
@rpc("any_peer", "call_local", "reliable")
|
||||
func complete_race(final_position: int):
|
||||
|
||||
Reference in New Issue
Block a user