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/bushes.gd
Normal file
36
Entities/GroundTile/scripts/bushes.gd
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
# GrassController.gd
|
||||
extends Node3D
|
||||
class_name BushController
|
||||
|
||||
@onready var bush_multimesh: MultiMeshInstance3D = $BushMultimesh
|
||||
var parent_node: GroundTile = null
|
||||
var bush_density: float = 0.5
|
||||
var bush_instance_range: int = 10
|
||||
|
||||
func _ready() -> void:
|
||||
parent_node = get_parent() as GroundTile
|
||||
|
||||
func spawn_bushes_for_cell(value):
|
||||
if value == null:
|
||||
return
|
||||
|
||||
bush_density = value.vegetation_density
|
||||
update_bush_density()
|
||||
|
||||
if bush_multimesh and bush_multimesh.has_method("setup_multimesh"):
|
||||
bush_multimesh.setup_multimesh()
|
||||
|
||||
func update_bush_density() -> void:
|
||||
if parent_node == null:
|
||||
return
|
||||
|
||||
var rng = parent_node.get_rng()
|
||||
|
||||
if bush_density > 0.8:
|
||||
bush_instance_range = rng.randi_range(5, 10)
|
||||
elif bush_density > 0.6:
|
||||
bush_instance_range = rng.randi_range(2, 7)
|
||||
elif bush_density > 0.3:
|
||||
bush_instance_range = rng.randi_range(0, 1)
|
||||
else:
|
||||
bush_instance_range = rng.randi_range(0, 0)
|
||||
Loading…
Add table
Add a link
Reference in a new issue