Adds bushes and flowers to ground tiles
Implements bush and flower spawning on ground tiles based on vegetation density. Adds new assets for bushes and flowers, and introduces multi-mesh rendering for optimized performance. Introduces seasonal color variations for vegetation using a shader for bushes and materials for flowers and grass. Refactors material application into a MaterialManager to handle material assignments over multiple frames. Moves ground tile scripts into a subfolder. Adds floating particles to test scene.
This commit is contained in:
parent
ea5006e8a2
commit
3959333534
46 changed files with 559 additions and 77 deletions
36
Entities/GroundTile/scripts/flowers.gd
Normal file
36
Entities/GroundTile/scripts/flowers.gd
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
# GrassController.gd
|
||||
extends Node3D
|
||||
class_name FlowerController
|
||||
|
||||
@onready var flower_multimesh: MultiMeshInstance3D = $FlowerMultimesh
|
||||
var parent_node: GroundTile = null
|
||||
var flower_density: float = 0.5
|
||||
var flower_instance_range: int = 10
|
||||
|
||||
func _ready() -> void:
|
||||
parent_node = get_parent() as GroundTile
|
||||
|
||||
func spawn_flowers_for_cell(value):
|
||||
if value == null:
|
||||
return
|
||||
|
||||
flower_density = value.vegetation_density
|
||||
update_flower_density()
|
||||
|
||||
if flower_multimesh and flower_multimesh.has_method("setup_multimesh"):
|
||||
flower_multimesh.setup_multimesh()
|
||||
|
||||
func update_flower_density() -> void:
|
||||
if parent_node == null:
|
||||
return
|
||||
|
||||
var rng = parent_node.get_rng()
|
||||
|
||||
if flower_density > 0.8:
|
||||
flower_instance_range = rng.randi_range(1, 3)
|
||||
elif flower_density > 0.6:
|
||||
flower_instance_range = rng.randi_range(3, 4)
|
||||
elif flower_density > 0.3:
|
||||
flower_instance_range = rng.randi_range(4, 7)
|
||||
else:
|
||||
flower_instance_range = rng.randi_range(5, 10)
|
||||
Loading…
Add table
Add a link
Reference in a new issue