changement du scene manager, amélioration du cockpit et autres
* refonte du scene manager * refonte du audio manager * premier rework des plantes * nettoyage des dossiers/fichiers * renommage de planète en region * fix des run
This commit is contained in:
@@ -8,47 +8,38 @@ const PARTICLES_SCENE : PackedScene = preload("res://common/vfx/particles/partic
|
||||
|
||||
signal harvest_animation_finished
|
||||
|
||||
func update_plant_sprite(plant : Plant, with_animation = false):
|
||||
if with_animation:
|
||||
%AnimationPlayer.play("bump")
|
||||
await %AnimationPlayer.animation_finished
|
||||
|
||||
%Sprite.flip_h = true if randi()%2 == 0 else false
|
||||
var last_updated_on_state : PlantData.State = PlantData.State.MATURE
|
||||
|
||||
%Sprite.texture = get_state_texture(plant.state, plant.plant_type)
|
||||
func update_plant_sprite(plant_data : PlantData, with_animation = false):
|
||||
if with_animation:
|
||||
%AnimationPlayer.play("bump")
|
||||
await %AnimationPlayer.animation_finished
|
||||
|
||||
%Sprite.flip_h = true if plant_data.random_seed%2 == 0 else false
|
||||
%Sprite.texture = plant_data.get_plant_texture()
|
||||
|
||||
%PlantedSeed.visible = plant.state == Plant.State.PLANTED
|
||||
%PlantedSeed.texture = plant.plant_type.seed_texture
|
||||
%PlantedSeed.texture = plant_data.get_seed_texture()
|
||||
%PlantedSeed.visible = plant_data.get_state() == PlantData.State.PLANTED
|
||||
|
||||
%PlantedSeed.region_rect = Rect2(
|
||||
0,
|
||||
PLANTED_SEED_POS_Y,
|
||||
plant.plant_type.seed_texture.get_width(),
|
||||
plant.plant_type.seed_texture.get_height() - PLANTED_SEED_CROP_WIDTH + -1 * PLANTED_SEED_POS_Y,
|
||||
)
|
||||
|
||||
func get_state_texture(s: Plant.State, plant_type : PlantType) -> Texture2D:
|
||||
match s:
|
||||
Plant.State.PLANTED:
|
||||
return null
|
||||
Plant.State.GROWING:
|
||||
return plant_type.growing_texture
|
||||
Plant.State.MATURE:
|
||||
return plant_type.mature_texture
|
||||
return null
|
||||
# %PlantedSeed.region_rect = Rect2(
|
||||
# 0,
|
||||
# PLANTED_SEED_POS_Y,
|
||||
# %PlantedSeed.texture.get_width(),
|
||||
# %PlantedSeed.texture.texture.get_height() - PLANTED_SEED_CROP_WIDTH + -1 * PLANTED_SEED_POS_Y,
|
||||
# )
|
||||
|
||||
func generate_mutation_effects(plant : Plant):
|
||||
for m in plant.plant_mutations:
|
||||
var particles_emitter : Particles = PARTICLES_SCENE.instantiate() as CPUParticles2D
|
||||
particles_emitter.setup_particles(
|
||||
Particles.Parameters.new(
|
||||
m.get_icon(),
|
||||
PlantMutation.get_rarity_color(m.get_rarity())
|
||||
)
|
||||
)
|
||||
add_child(particles_emitter)
|
||||
for m in plant.data.mutations:
|
||||
var particles_emitter : Particles = PARTICLES_SCENE.instantiate() as CPUParticles2D
|
||||
particles_emitter.setup_particles(
|
||||
Particles.Parameters.new(
|
||||
m.get_icon(),
|
||||
PlantMutation.get_rarity_color(m.get_rarity())
|
||||
)
|
||||
)
|
||||
add_child(particles_emitter)
|
||||
|
||||
func start_harvest_animation():
|
||||
$AnimationPlayer.play("harvest")
|
||||
await $AnimationPlayer.animation_finished
|
||||
harvest_animation_finished.emit()
|
||||
$AnimationPlayer.play("harvest")
|
||||
await $AnimationPlayer.animation_finished
|
||||
harvest_animation_finished.emit()
|
||||
|
||||
Reference in New Issue
Block a user