feat: implement special tiles manager for power-ups, including inventory, levels, cooldowns, and effect activation.
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
|
||||
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_n7oje"]
|
||||
transparency = 1
|
||||
albedo_color = Color(0.30980393, 0.30980393, 0.30980393, 1)
|
||||
albedo_color = Color(0.30980393, 0.30980393, 0.30980393, 0.5921569)
|
||||
|
||||
[resource]
|
||||
material = SubResource("StandardMaterial3D_n7oje")
|
||||
|
||||
+1
-1
@@ -228,7 +228,7 @@ func _ready():
|
||||
var mat = ShaderMaterial.new()
|
||||
mat.shader = pointer_shader
|
||||
|
||||
if is_multiplayer_authority():
|
||||
if name == str(multiplayer.get_unique_id()):
|
||||
mat.set_shader_parameter("pointer_color", Color(0.0, 1.0, 0.0, 1.0)) # Green
|
||||
else:
|
||||
mat.set_shader_parameter("pointer_color", Color(1.0, 0.0, 0.0, 1.0)) # Red
|
||||
|
||||
@@ -94,7 +94,7 @@ var blocked_tiles: Array[Dictionary] = [] # {position: Vector3i, original_item:
|
||||
var freeze_zones: Array[Dictionary] = [] # {position: Vector2i, timer: float}
|
||||
var active_freeze_zones: Array = [] # Array of {center, radius, timer}
|
||||
var invisible_timer: float = 0.0
|
||||
|
||||
var global_cooldown_timer: float = 0.0
|
||||
|
||||
# INVENTORY SYSTEM
|
||||
# Stores count of each power-up type. Max 1 per type as per user request?
|
||||
@@ -202,6 +202,11 @@ func activate_effect(effect: int, target_player: Node3D = null):
|
||||
print("PowerUp %s not found in inventory or false. Inventory: %s" % [effect, inventory])
|
||||
return
|
||||
|
||||
# Check Cooldown
|
||||
if global_cooldown_timer > 0:
|
||||
NotificationManager.send_message(player, "Skill in Cooldown! (%.1fs)" % global_cooldown_timer, NotificationManager.MessageType.WARNING)
|
||||
return
|
||||
|
||||
# Check Attack Mode Restriction
|
||||
if player.get("is_attack_mode") and effect == SpecialEffect.INVISIBLE_MODE:
|
||||
NotificationManager.send_message(player, "Cannot enter Ghost mode while in Attack Mode!", NotificationManager.MessageType.WARNING)
|
||||
@@ -213,7 +218,7 @@ func activate_effect(effect: int, target_player: Node3D = null):
|
||||
return
|
||||
|
||||
var level = powerup_levels.get(effect, 1)
|
||||
print("[SpecialTiles] Player %s activated %s (Lvl %d). No cooldown applied." % [player.name, SpecialEffect.keys()[effect], level])
|
||||
print("[SpecialTiles] Player %s activated %s (Lvl %d)." % [player.name, SpecialEffect.keys()[effect], level])
|
||||
|
||||
match effect:
|
||||
SpecialEffect.FASTER_SPEED:
|
||||
@@ -227,6 +232,9 @@ func activate_effect(effect: int, target_player: Node3D = null):
|
||||
SpecialEffect.INVISIBLE_MODE:
|
||||
_execute_invisible_mode(player)
|
||||
|
||||
# Apply 5s cooldown globally
|
||||
global_cooldown_timer = 5.0
|
||||
|
||||
# Play generic cast animation or sound?
|
||||
if player.is_multiplayer_authority() and multiplayer.has_multiplayer_peer() and multiplayer.multiplayer_peer.get_connection_status() == MultiplayerPeer.CONNECTION_CONNECTED:
|
||||
player.rpc("trigger_screen_shake", "light")
|
||||
@@ -541,6 +549,10 @@ func _check_for_icy_floor():
|
||||
pass
|
||||
|
||||
func _process(delta):
|
||||
# Update Global Cooldown
|
||||
if global_cooldown_timer > 0:
|
||||
global_cooldown_timer -= delta
|
||||
|
||||
# Update Active Buffs (Speed)
|
||||
if active_buffs.has(SpecialEffect.FASTER_SPEED):
|
||||
active_buffs[SpecialEffect.FASTER_SPEED] -= delta
|
||||
|
||||
Reference in New Issue
Block a user