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"]
|
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_n7oje"]
|
||||||
transparency = 1
|
transparency = 1
|
||||||
albedo_color = Color(0.30980393, 0.30980393, 0.30980393, 1)
|
albedo_color = Color(0.30980393, 0.30980393, 0.30980393, 0.5921569)
|
||||||
|
|
||||||
[resource]
|
[resource]
|
||||||
material = SubResource("StandardMaterial3D_n7oje")
|
material = SubResource("StandardMaterial3D_n7oje")
|
||||||
|
|||||||
+1
-1
@@ -228,7 +228,7 @@ func _ready():
|
|||||||
var mat = ShaderMaterial.new()
|
var mat = ShaderMaterial.new()
|
||||||
mat.shader = pointer_shader
|
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
|
mat.set_shader_parameter("pointer_color", Color(0.0, 1.0, 0.0, 1.0)) # Green
|
||||||
else:
|
else:
|
||||||
mat.set_shader_parameter("pointer_color", Color(1.0, 0.0, 0.0, 1.0)) # Red
|
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 freeze_zones: Array[Dictionary] = [] # {position: Vector2i, timer: float}
|
||||||
var active_freeze_zones: Array = [] # Array of {center, radius, timer}
|
var active_freeze_zones: Array = [] # Array of {center, radius, timer}
|
||||||
var invisible_timer: float = 0.0
|
var invisible_timer: float = 0.0
|
||||||
|
var global_cooldown_timer: float = 0.0
|
||||||
|
|
||||||
# INVENTORY SYSTEM
|
# INVENTORY SYSTEM
|
||||||
# Stores count of each power-up type. Max 1 per type as per user request?
|
# 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])
|
print("PowerUp %s not found in inventory or false. Inventory: %s" % [effect, inventory])
|
||||||
return
|
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
|
# Check Attack Mode Restriction
|
||||||
if player.get("is_attack_mode") and effect == SpecialEffect.INVISIBLE_MODE:
|
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)
|
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
|
return
|
||||||
|
|
||||||
var level = powerup_levels.get(effect, 1)
|
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:
|
match effect:
|
||||||
SpecialEffect.FASTER_SPEED:
|
SpecialEffect.FASTER_SPEED:
|
||||||
@@ -227,6 +232,9 @@ func activate_effect(effect: int, target_player: Node3D = null):
|
|||||||
SpecialEffect.INVISIBLE_MODE:
|
SpecialEffect.INVISIBLE_MODE:
|
||||||
_execute_invisible_mode(player)
|
_execute_invisible_mode(player)
|
||||||
|
|
||||||
|
# Apply 5s cooldown globally
|
||||||
|
global_cooldown_timer = 5.0
|
||||||
|
|
||||||
# Play generic cast animation or sound?
|
# 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:
|
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")
|
player.rpc("trigger_screen_shake", "light")
|
||||||
@@ -541,6 +549,10 @@ func _check_for_icy_floor():
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
func _process(delta):
|
func _process(delta):
|
||||||
|
# Update Global Cooldown
|
||||||
|
if global_cooldown_timer > 0:
|
||||||
|
global_cooldown_timer -= delta
|
||||||
|
|
||||||
# Update Active Buffs (Speed)
|
# Update Active Buffs (Speed)
|
||||||
if active_buffs.has(SpecialEffect.FASTER_SPEED):
|
if active_buffs.has(SpecialEffect.FASTER_SPEED):
|
||||||
active_buffs[SpecialEffect.FASTER_SPEED] -= delta
|
active_buffs[SpecialEffect.FASTER_SPEED] -= delta
|
||||||
|
|||||||
Reference in New Issue
Block a user