modification de l'UI en 3D et renommage des particules
This commit is contained in:
@@ -3,24 +3,24 @@ class_name ItemObjectSprite
|
||||
|
||||
@onready var icon_sprite = $Icon
|
||||
|
||||
const PARTICLES_SCENE : PackedScene = preload("res://common/vfx/particles/particles.tscn")
|
||||
const PARTICLES_SCENE : PackedScene = preload("res://common/vfx/particles/effect_particles.tscn")
|
||||
|
||||
func apply_texture_to_sprite(texture, item_sprite_size = 50.):
|
||||
if texture:
|
||||
icon_sprite.texture = texture
|
||||
icon_sprite.scale = Vector2(
|
||||
1./(texture.get_width()/item_sprite_size),
|
||||
1./(texture.get_height()/item_sprite_size)
|
||||
)
|
||||
if texture:
|
||||
icon_sprite.texture = texture
|
||||
icon_sprite.scale = Vector2(
|
||||
1./(texture.get_width()/item_sprite_size),
|
||||
1./(texture.get_height()/item_sprite_size)
|
||||
)
|
||||
|
||||
func generate_particles(particles_params : Array[Particles.Parameters]):
|
||||
for c in get_children():
|
||||
if c is Particles: queue_free()
|
||||
func generate_particles(particles_params : Array[EffectParticles.Parameters]):
|
||||
for c in get_children():
|
||||
if c is EffectParticles: queue_free()
|
||||
|
||||
for params in particles_params:
|
||||
var particles_emitter : Particles = PARTICLES_SCENE.instantiate() as Particles
|
||||
particles_emitter.setup_particles(params)
|
||||
add_child(particles_emitter)
|
||||
for params in particles_params:
|
||||
var particles_emitter : EffectParticles = PARTICLES_SCENE.instantiate() as EffectParticles
|
||||
particles_emitter.setup_particles(params)
|
||||
add_child(particles_emitter)
|
||||
|
||||
func pickup_animation():
|
||||
%AnimationPlayer.play("pickup")
|
||||
%AnimationPlayer.play("pickup")
|
||||
|
||||
@@ -4,7 +4,7 @@ class_name PlantSprite
|
||||
const PLANTED_SEED_CROP_WIDTH = 50
|
||||
const PLANTED_SEED_POS_Y = 0
|
||||
|
||||
const PARTICLES_SCENE : PackedScene = preload("res://common/vfx/particles/particles.tscn")
|
||||
const PARTICLES_SCENE : PackedScene = preload("res://common/vfx/particles/effect_particles.tscn")
|
||||
|
||||
signal harvest_animation_finished
|
||||
|
||||
@@ -30,9 +30,9 @@ func update_plant_sprite(plant_data : PlantData, with_animation = false):
|
||||
|
||||
func generate_mutation_effects(plant : Plant):
|
||||
for m in plant.data.mutations:
|
||||
var particles_emitter : Particles = PARTICLES_SCENE.instantiate() as CPUParticles2D
|
||||
var particles_emitter : EffectParticles = PARTICLES_SCENE.instantiate() as EffectParticles
|
||||
particles_emitter.setup_particles(
|
||||
Particles.Parameters.new(
|
||||
EffectParticles.Parameters.new(
|
||||
m.get_icon(),
|
||||
PlantMutation.get_rarity_color(m.get_rarity())
|
||||
)
|
||||
|
||||
@@ -13,61 +13,61 @@ const ONE_TIME_ICON = preload("res://common/icons/circle-number-1.svg")
|
||||
@export var energy_usage : int = 1 : get = get_energy_used
|
||||
|
||||
func get_item_name() -> String:
|
||||
return name
|
||||
return name
|
||||
|
||||
func get_description() -> String:
|
||||
return description
|
||||
return description
|
||||
|
||||
func get_icon() -> Texture2D:
|
||||
return icon
|
||||
return icon
|
||||
|
||||
func get_energy_used() -> int:
|
||||
return energy_usage
|
||||
return energy_usage
|
||||
|
||||
func get_usage_zone_radius() -> int:
|
||||
return usage_zone_radius
|
||||
return usage_zone_radius
|
||||
|
||||
func get_usage_object_affected(_i : InspectableEntity) -> bool:
|
||||
return false
|
||||
return false
|
||||
|
||||
func is_one_time_use():
|
||||
return false
|
||||
return false
|
||||
|
||||
func can_use(_player : Player, _zone: Player.ActionZone) -> bool:
|
||||
return false
|
||||
return false
|
||||
|
||||
func use_text() -> String:
|
||||
return ""
|
||||
return ""
|
||||
|
||||
func use(_player : Player, _zone: Player.ActionZone):
|
||||
return false
|
||||
return false
|
||||
|
||||
func card_info() -> CardInfo:
|
||||
var info = CardInfo.new(
|
||||
get_item_name()
|
||||
)
|
||||
info.texture = icon
|
||||
info.type_icon = TYPE_ICON
|
||||
var info = CardInfo.new(
|
||||
get_item_name()
|
||||
)
|
||||
info.texture = icon
|
||||
info.type_icon = TYPE_ICON
|
||||
|
||||
info.stats.append(
|
||||
CardStatInfo.new(
|
||||
str(energy_usage),
|
||||
ENERGY_ICON
|
||||
)
|
||||
)
|
||||
info.stats.append(
|
||||
CardStatInfo.new(
|
||||
str(energy_usage),
|
||||
ENERGY_ICON
|
||||
)
|
||||
)
|
||||
|
||||
var effect_section = CardSectionInfo.new(
|
||||
tr("EFFECT"),
|
||||
get_description()
|
||||
)
|
||||
effect_section.title_icon = ACTION_ICON
|
||||
var effect_section = CardSectionInfo.new(
|
||||
tr("EFFECT"),
|
||||
get_description()
|
||||
)
|
||||
effect_section.title_icon = ACTION_ICON
|
||||
|
||||
if energy_usage > 0:
|
||||
effect_section.title_icon = ENERGY_ICON
|
||||
|
||||
info.sections.append(effect_section)
|
||||
if energy_usage > 0:
|
||||
effect_section.title_icon = ENERGY_ICON
|
||||
|
||||
info.sections.append(effect_section)
|
||||
|
||||
return info
|
||||
return info
|
||||
|
||||
func get_particles() -> Array[Particles.Parameters]:
|
||||
return []
|
||||
func get_particles() -> Array[EffectParticles.Parameters]:
|
||||
return []
|
||||
|
||||
@@ -128,12 +128,12 @@ func card_info() -> CardInfo:
|
||||
|
||||
return info
|
||||
|
||||
func get_particles() -> Array[Particles.Parameters]:
|
||||
var param : Array[Particles.Parameters] = []
|
||||
func get_particles() -> Array[EffectParticles.Parameters]:
|
||||
var param : Array[EffectParticles.Parameters] = []
|
||||
|
||||
for m in plant_mutations:
|
||||
param.append(
|
||||
Particles.Parameters.new(
|
||||
EffectParticles.Parameters.new(
|
||||
m.get_icon(),
|
||||
PlantMutation.get_rarity_color(m.get_rarity())
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user