added notification for picking up card

This commit is contained in:
2023-12-08 18:25:15 +11:00
parent c75ba6461a
commit e97bf84612
7 changed files with 157 additions and 36 deletions

View File

@ -165,16 +165,16 @@ func networked_spawn_wall(pos : Vector3, name_id : int, caller_id : int):
@rpc("reliable", "call_local", "any_peer")
func networked_remove_wall(wall_id: int):
var wall = tower_base_ids[wall_id]
func networked_remove_wall(new_wall_id: int):
var wall = tower_base_ids[new_wall_id]
Game.connected_players_nodes[wall.owner_id].currency += Data.wall_cost
tower_bases.erase(wall)
tower_base_ids.erase(wall_id)
tower_base_ids.erase(new_wall_id)
wall.queue_free()
var north_point = get_north_point(wall_id)
var south_point = get_south_point(wall_id)
var east_point = get_east_point(wall_id)
var west_point = get_west_point(wall_id)
var north_point = get_north_point(new_wall_id)
var south_point = get_south_point(new_wall_id)
var east_point = get_east_point(new_wall_id)
var west_point = get_west_point(new_wall_id)
if north_point >= 0 and astar.is_point_disabled(north_point):
tower_base_ids[north_point].set_south_wall(false)
if south_point >= 0 and astar.is_point_disabled(south_point):

View File

@ -18,6 +18,7 @@ var enemy_names = []
@export var enemy_counts : Array[Label]
@export var weapon_energy_bar : TextureProgressBar
@export var offhand_energy_bar : TextureProgressBar
@export var pickup_notif_scene : PackedScene
func set_energy_visible(value):
@ -119,3 +120,9 @@ func minimize_minimap(anchor):
minimap_cam.size = 15
minimap_outline.set_visible(true)
currency_count.set_visible(true)
func pickup(card: Card) -> void:
var notif = pickup_notif_scene.instantiate()
notif.set_card(card)
$VBoxContainer.add_child(notif)

View File

@ -38,6 +38,9 @@ func _process(delta: float) -> void:
ray_collider = null
ray_point = null
wall_preview.set_visible(false)
if is_instance_valid(last_collider):
Game.level.a_star_graph_3d.tower_base_ids[last_collider.point_id].set_material(null)
last_collider = null
return
if interact_key_held and !interacted_once and valid_point and hero.currency >= Data.wall_cost and ray.is_colliding() and Game.level.a_star_graph_3d.point_is_build_location(point_id):

View File

@ -0,0 +1,50 @@
extends PanelContainer
@export var fade_out_time: float
@export var style: StyleBoxFlat
@export var text_style: Color
@export var common_background: Color
@export var uncommon_background: Color
@export var rare_background: Color
@export var epic_background: Color
@export var legendary_background: Color
var fade_time = 0.0
var fading = false
func _ready() -> void:
add_theme_stylebox_override("panel", style)
$HBoxContainer/Label.add_theme_color_override("font_color", text_style)
$HBoxContainer/Label2.add_theme_color_override("font_color", text_style)
$Timer.start()
func _process(delta: float) -> void:
if fading:
fade_time += delta
style.bg_color.a = lerp(200.0 / 255.0, 0.0, fade_time / fade_out_time)
text_style.a = lerp(220.0 / 255.0, 0.0, fade_time / fade_out_time)
$HBoxContainer/Label.add_theme_color_override("font_color", text_style)
$HBoxContainer/Label2.add_theme_color_override("font_color", text_style)
if fade_time >= fade_out_time:
queue_free()
func set_card(card: Card) -> void:
$HBoxContainer/Label.text = card.display_name
match(card.rarity):
Data.Rarity.COMMON:
style.bg_color = common_background
Data.Rarity.UNCOMMON:
style.bg_color = uncommon_background
Data.Rarity.RARE:
style.bg_color = rare_background
Data.Rarity.EPIC:
style.bg_color = epic_background
Data.Rarity.LEGENDARY:
style.bg_color = legendary_background
func _on_timer_timeout() -> void:
fading = true