Improves tree and ground tile appearance
Refactors tree spawning and rendering: - Adds seasonal color variations for trees via scripts. - Introduces `ColorStorage` to manage tree and grass colors - Removes unused code from tree spawning logic. - Adjusts ground tile color for better visual appeal. - Hides debug text on ground tiles.
This commit is contained in:
parent
734730beee
commit
ea5006e8a2
28 changed files with 454 additions and 63 deletions
|
|
@ -1,11 +1,15 @@
|
|||
[gd_resource type="Resource" script_class="TreeDataCollection" load_steps=11 format=3 uid="uid://buf5mtxc5f7o"]
|
||||
[gd_resource type="Resource" script_class="TreeDataCollection" load_steps=15 format=3 uid="uid://buf5mtxc5f7o"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://dj4dhsd0m0bvd" path="res://Entities/Tree/resources/TreeDataCollection.gd" id="1_7y4l8"]
|
||||
[ext_resource type="Script" uid="uid://cdudelqysppwl" path="res://Entities/Tree/resources/TreeDataResource.gd" id="2_4yk3p"]
|
||||
[ext_resource type="PackedScene" uid="uid://g74ar24o4s1" path="res://Entities/Tree/assets/tree_oak.glb" id="3_4yk3p"]
|
||||
[ext_resource type="PackedScene" uid="uid://bwhpbjdyl577e" path="res://Entities/Tree/assets/tree.glb" id="4_4wxxs"]
|
||||
[ext_resource type="Script" uid="uid://bjsj2j01nmnfq" path="res://Entities/Tree/scripts/color_tree_oak.gd" id="3_itox7"]
|
||||
[ext_resource type="PackedScene" uid="uid://besaean4w1n83" path="res://Entities/Tree/assets/tree_birch.glb" id="5_35hba"]
|
||||
[ext_resource type="Script" uid="uid://de77441cemrqe" path="res://Entities/Tree/scripts/color_tree_pine.gd" id="5_cyc7o"]
|
||||
[ext_resource type="PackedScene" uid="uid://b3lc1nbuv5ol8" path="res://Entities/Tree/assets/tree_detailed.glb" id="6_ibfiw"]
|
||||
[ext_resource type="PackedScene" uid="uid://brabfdgw5vs1o" path="res://Entities/Tree/assets/tree_pineDefaultA.glb" id="6_itox7"]
|
||||
[ext_resource type="Script" uid="uid://dk04iuaocilih" path="res://Entities/Tree/scripts/color_tree_birch.gd" id="7_cyc7o"]
|
||||
[ext_resource type="Script" uid="uid://3flh70jpmq2w" path="res://Entities/Tree/scripts/color_tree_elder.gd" id="9_dydvk"]
|
||||
|
||||
[sub_resource type="Resource" id="Resource_7y4l8"]
|
||||
script = ExtResource("2_4yk3p")
|
||||
|
|
@ -17,28 +21,44 @@ moisture_range = Vector2(0.3, 0.8)
|
|||
elevation_range = Vector2(0.1, 0.5)
|
||||
max_height = 15.0
|
||||
growth_time = 120.0
|
||||
spawn_probability = 0.1
|
||||
spread_radius = 5.0
|
||||
seasonal_models = Array[PackedScene]([])
|
||||
drops_leaves = true
|
||||
leaf_color_variations = Array[Color]([])
|
||||
color_script = ExtResource("3_itox7")
|
||||
spring_leaf_color = Color(0.419608, 0.556863, 0.137255, 1)
|
||||
summer_leaf_color = Color(0.419608, 0.556863, 0.137255, 1)
|
||||
autumn_leaf_color = Color(0.624662, 0.302547, 1.92523e-07, 1)
|
||||
winter_leaf_color = Color(0.784314, 0.823529, 0.745098, 1)
|
||||
spring_trunk_color = Color(0.627451, 0.321569, 0.176471, 1)
|
||||
summer_trunk_color = Color(0.627451, 0.321569, 0.176471, 1)
|
||||
autumn_trunk_color = Color(0.4, 0.2, 0.1, 1)
|
||||
winter_trunk_color = Color(0.3, 0.2, 0.1, 1)
|
||||
metadata/_custom_type_script = "uid://cdudelqysppwl"
|
||||
|
||||
[sub_resource type="Resource" id="Resource_35hba"]
|
||||
script = ExtResource("2_4yk3p")
|
||||
tree_name = "Pine"
|
||||
model = ExtResource("4_4wxxs")
|
||||
model = ExtResource("6_itox7")
|
||||
growth_stages = Array[PackedScene]([])
|
||||
temperature_range = Vector2(0.1, 0.6)
|
||||
moisture_range = Vector2(0.2, 0.6)
|
||||
elevation_range = Vector2(0.7, 1)
|
||||
max_height = 15.0
|
||||
growth_time = 120.0
|
||||
spawn_probability = 0.1
|
||||
spread_radius = 5.0
|
||||
seasonal_models = Array[PackedScene]([])
|
||||
drops_leaves = true
|
||||
leaf_color_variations = Array[Color]([])
|
||||
color_script = ExtResource("5_cyc7o")
|
||||
spring_leaf_color = Color(0.196078, 0.501961, 0.196078, 1)
|
||||
summer_leaf_color = Color(0.00392157, 0.196078, 0.12549, 1)
|
||||
autumn_leaf_color = Color(0.133333, 0.376471, 0.168627, 1)
|
||||
winter_leaf_color = Color(0.266667, 0.376471, 0.298039, 1)
|
||||
spring_trunk_color = Color(0.396078, 0.262745, 0.129412, 1)
|
||||
summer_trunk_color = Color(0.396078, 0.262745, 0.129412, 1)
|
||||
autumn_trunk_color = Color(0.396078, 0.262745, 0.129412, 1)
|
||||
winter_trunk_color = Color(0.313726, 0.207843, 0.101961, 1)
|
||||
metadata/_custom_type_script = "uid://cdudelqysppwl"
|
||||
|
||||
[sub_resource type="Resource" id="Resource_4wxxs"]
|
||||
|
|
@ -51,11 +71,19 @@ moisture_range = Vector2(0.5, 0.6)
|
|||
elevation_range = Vector2(0.1, 0.5)
|
||||
max_height = 15.0
|
||||
growth_time = 120.0
|
||||
spawn_probability = 0.1
|
||||
spread_radius = 5.0
|
||||
seasonal_models = Array[PackedScene]([])
|
||||
drops_leaves = true
|
||||
leaf_color_variations = Array[Color]([])
|
||||
color_script = ExtResource("7_cyc7o")
|
||||
spring_leaf_color = Color(0.678431, 0.933333, 0.466667, 1)
|
||||
summer_leaf_color = Color(0.603922, 0.803922, 0.196078, 1)
|
||||
autumn_leaf_color = Color(1, 0.843137, 0, 1)
|
||||
winter_leaf_color = Color(0.898039, 0.917647, 0.823529, 1)
|
||||
spring_trunk_color = Color(0.960784, 0.960784, 0.862745, 1)
|
||||
summer_trunk_color = Color(0.960784, 0.960784, 0.862745, 1)
|
||||
autumn_trunk_color = Color(0.960784, 0.960784, 0.862745, 1)
|
||||
winter_trunk_color = Color(0.862745, 0.862745, 0.784314, 1)
|
||||
metadata/_custom_type_script = "uid://cdudelqysppwl"
|
||||
|
||||
[sub_resource type="Resource" id="Resource_54eyh"]
|
||||
|
|
@ -68,11 +96,19 @@ moisture_range = Vector2(0.7, 1)
|
|||
elevation_range = Vector2(0, 0.2)
|
||||
max_height = 15.0
|
||||
growth_time = 120.0
|
||||
spawn_probability = 0.1
|
||||
spread_radius = 5.0
|
||||
seasonal_models = Array[PackedScene]([])
|
||||
drops_leaves = true
|
||||
leaf_color_variations = Array[Color]([])
|
||||
color_script = ExtResource("9_dydvk")
|
||||
spring_leaf_color = Color(0.564706, 0.933333, 0.564706, 1)
|
||||
summer_leaf_color = Color(0.196078, 0.803922, 0.196078, 1)
|
||||
autumn_leaf_color = Color(0.545098, 0.270588, 0.0745098, 1)
|
||||
winter_leaf_color = Color(0.627451, 0.666667, 0.627451, 1)
|
||||
spring_trunk_color = Color(0.411765, 0.411765, 0.411765, 1)
|
||||
summer_trunk_color = Color(0.411765, 0.411765, 0.411765, 1)
|
||||
autumn_trunk_color = Color(0.411765, 0.411765, 0.411765, 1)
|
||||
winter_trunk_color = Color(0.329412, 0.329412, 0.329412, 1)
|
||||
metadata/_custom_type_script = "uid://cdudelqysppwl"
|
||||
|
||||
[resource]
|
||||
|
|
|
|||
|
|
@ -14,10 +14,40 @@ extends Resource
|
|||
@export_group("Growth Properties")
|
||||
@export var max_height: float = 15.0
|
||||
@export var growth_time: float = 120.0 # Seconds to full growth
|
||||
@export var spawn_probability: float = 0.1
|
||||
@export var spread_radius: float = 5.0
|
||||
|
||||
@export_group("Seasonal Behavior")
|
||||
@export var seasonal_models: Array[PackedScene] = [] # Spring, Summer, Fall, Winter
|
||||
@export var drops_leaves: bool = true
|
||||
@export var leaf_color_variations: Array[Color] = []
|
||||
|
||||
@export_group("Tree Color Management")
|
||||
@export var color_script: GDScript = null
|
||||
|
||||
@export_group("Leaf Colors")
|
||||
@export var spring_leaf_color: Color = Color(0.0, 1.0, 0.0) # Green
|
||||
@export var summer_leaf_color: Color = Color(0.0, 0.5, 0.0) # Darker green
|
||||
@export var autumn_leaf_color: Color = Color(1.0, 0.5, 0.0) # Orange
|
||||
@export var winter_leaf_color: Color = Color(0.5, 0.5, 0.5) # Gray/Brown
|
||||
|
||||
@export_group("Trunk Colors")
|
||||
@export var spring_trunk_color: Color = Color(0.6, 0.4, 0.2) # Brown
|
||||
@export var summer_trunk_color: Color = Color(0.5, 0.3, 0.1) # Darker brown
|
||||
@export var autumn_trunk_color: Color = Color(0.4, 0.2, 0.1) # Darker brown
|
||||
@export var winter_trunk_color: Color = Color(0.3, 0.2, 0.1) # Very dark brown
|
||||
|
||||
func apply_seasonal_colors(instance_model: Node3D, season: String = "summer") -> void:
|
||||
if color_script == null:
|
||||
return
|
||||
|
||||
var script_instance = color_script.new()
|
||||
|
||||
# Pass the tree name and season to the color script
|
||||
if script_instance.has_method("set_tree_info"):
|
||||
script_instance.set_tree_info(tree_name, season)
|
||||
|
||||
|
||||
if script_instance.has_method("set_leaf_color"):
|
||||
script_instance.set_leaf_color(instance_model)
|
||||
if script_instance.has_method("set_trunk_color"):
|
||||
script_instance.set_trunk_color(instance_model)
|
||||
Loading…
Add table
Add a link
Reference in a new issue