From 49dd2fecf0aca0cbc06e72a33e3cce792b1dd5e4 Mon Sep 17 00:00:00 2001 From: Rob Kelly Date: Thu, 21 Nov 2024 17:41:55 -0700 Subject: [PATCH] Colorized gfolfers! --- .../player_characters/character_controller.gd | 5 +++++ .../gfolf_girl/gfolf_girl.gd | 16 ++++++++++++++ .../gfolf_girl/gfolf_girl.tscn | 9 +++++--- src/player/debug_orange.tres | 21 +++++++++++++++++++ src/player/debug_player.tres | 2 +- src/player/shot_setup/shot_setup.gd | 3 +++ src/world/world.tscn | 5 +++-- 7 files changed, 55 insertions(+), 6 deletions(-) create mode 100644 src/characters/player_characters/gfolf_girl/gfolf_girl.gd create mode 100644 src/player/debug_orange.tres diff --git a/src/characters/player_characters/character_controller.gd b/src/characters/player_characters/character_controller.gd index bf286ab..798ca01 100644 --- a/src/characters/player_characters/character_controller.gd +++ b/src/characters/player_characters/character_controller.gd @@ -21,6 +21,11 @@ func hold_right(node: Node3D = null) -> void: node.transform = Transform3D.IDENTITY +## Set this character's color. Implementation-dependent. +func set_color(color: Color) -> void: + pass + + func reset() -> void: animation_state.start("stand_to_idle") diff --git a/src/characters/player_characters/gfolf_girl/gfolf_girl.gd b/src/characters/player_characters/gfolf_girl/gfolf_girl.gd new file mode 100644 index 0000000..3420660 --- /dev/null +++ b/src/characters/player_characters/gfolf_girl/gfolf_girl.gd @@ -0,0 +1,16 @@ +extends CharacterController + +const SHIRT_MAT := preload("res://assets/models/characters/gfolf_girl/Shirt.tres") +const SHIRT_SURFACE_ID := 0 +const ARM_SURFACE_ID := 0 + +@onready var shirt: MeshInstance3D = $Armature/Skeleton3D/Shirt +@onready var arm: MeshInstance3D = $Armature/Skeleton3D/Arm_L + + +func set_color(color: Color) -> void: + var material: BaseMaterial3D = SHIRT_MAT.duplicate() + material.resource_local_to_scene = true + material.albedo_color = color + shirt.set_surface_override_material(SHIRT_SURFACE_ID, material) + arm.set_surface_override_material(ARM_SURFACE_ID, material) diff --git a/src/characters/player_characters/gfolf_girl/gfolf_girl.tscn b/src/characters/player_characters/gfolf_girl/gfolf_girl.tscn index ed661a3..8e8b760 100644 --- a/src/characters/player_characters/gfolf_girl/gfolf_girl.tscn +++ b/src/characters/player_characters/gfolf_girl/gfolf_girl.tscn @@ -1,7 +1,7 @@ [gd_scene load_steps=22 format=3 uid="uid://1s3gywmoi20e"] [ext_resource type="PackedScene" uid="uid://ha6jxf4v5845" path="res://assets/models/characters/gfolf_girl/gfolf_girl.gltf" id="1_j80rr"] -[ext_resource type="Script" path="res://src/characters/player_characters/character_controller.gd" id="2_7o84v"] +[ext_resource type="Script" path="res://src/characters/player_characters/gfolf_girl/gfolf_girl.gd" id="2_y16an"] [ext_resource type="Script" path="res://src/util/random_timer.gd" id="3_ex68g"] [sub_resource type="StandardMaterial3D" id="StandardMaterial3D_fokhu"] @@ -122,7 +122,7 @@ _data = { } [node name="GfolfGirl" instance=ExtResource("1_j80rr")] -script = ExtResource("2_7o84v") +script = ExtResource("2_y16an") [node name="Armature" parent="." index="0"] transform = Transform3D(0.2, 0, 0, 0, 0.2, 0, 0, 0, 0.2, 0, 0, 0) @@ -165,8 +165,11 @@ bones/22/scale = Vector3(1, 1, 1) bones/23/rotation = Quaternion(0.000222673, 0.707107, 0.707107, -0.000222504) bones/23/scale = Vector3(1, 1, 1) +[node name="Eyes_Closed" parent="Armature/Skeleton3D" index="1"] +visible = false + [node name="BoneAttachment3D" type="BoneAttachment3D" parent="Armature/Skeleton3D" index="6"] -transform = Transform3D(-0.949594, 0.297848, -0.0977661, -0.313159, -0.915477, 0.25265, -0.0142512, 0.270532, 0.962605, -0.14033, 3.24759, 0.85525) +transform = Transform3D(-0.0322548, -0.997872, -0.0566729, 0.999469, -0.0324597, 0.00269911, -0.00453275, -0.0565558, 0.998389, -2.5177, 5.22011, -0.51637) bone_name = "Hand.R" bone_idx = 11 diff --git a/src/player/debug_orange.tres b/src/player/debug_orange.tres new file mode 100644 index 0000000..bf793ef --- /dev/null +++ b/src/player/debug_orange.tres @@ -0,0 +1,21 @@ +[gd_resource type="Resource" script_class="WorldPlayer" load_steps=6 format=3 uid="uid://b5j0lmo4jayk4"] + +[ext_resource type="Resource" uid="uid://c1pnqsddvey3m" path="res://src/equipment/clubs/drivers/debug_driver.tres" id="1_nb6c3"] +[ext_resource type="Resource" uid="uid://ck17u5yn6k0bi" path="res://src/equipment/clubs/irons/debug_iron.tres" id="2_0ti3p"] +[ext_resource type="Resource" uid="uid://dagld0q5krapu" path="res://src/equipment/clubs/putters/debug_putter.tres" id="3_274x5"] +[ext_resource type="Script" path="res://src/player/world_player.gd" id="4_vid1t"] +[ext_resource type="Resource" uid="uid://dthtc1no2c4wy" path="res://src/equipment/clubs/wedges/debug_wedge.tres" id="5_hfqcn"] + +[resource] +script = ExtResource("4_vid1t") +life = 100.0 +name = "Orange Gfolfer" +color = Color(1, 0.748, 0.44, 1) +driver = ExtResource("1_nb6c3") +iron = ExtResource("2_0ti3p") +wedge = ExtResource("5_hfqcn") +putter = ExtResource("3_274x5") +_balls = { +1: -1, +2: 5 +} diff --git a/src/player/debug_player.tres b/src/player/debug_player.tres index 9083234..43a218a 100644 --- a/src/player/debug_player.tres +++ b/src/player/debug_player.tres @@ -10,7 +10,7 @@ script = ExtResource("4_8ybyj") life = 100.0 name = "DEBUG Gfolfer" -color = Color(1, 0.439216, 0.439216, 1) +color = Color(0.48, 1, 1, 1) driver = ExtResource("1_sn8fd") iron = ExtResource("2_piku2") wedge = ExtResource("5_wm4ae") diff --git a/src/player/shot_setup/shot_setup.gd b/src/player/shot_setup/shot_setup.gd index e9a22b0..7c0867a 100644 --- a/src/player/shot_setup/shot_setup.gd +++ b/src/player/shot_setup/shot_setup.gd @@ -174,6 +174,8 @@ func _ready() -> void: world.ui.add_player_hud(hud) ball_type = initial_ball club = initial_club + character.set_color(player.color) + _on_phase_change(phase) func _set_camera_distance(value: float) -> void: @@ -439,6 +441,7 @@ func _on_phase_change(new_phase: Phase) -> void: Phase.FINISHED: hud.power_bar.hide() hud.curve_bar.hide() + hud.hide_hud() finished.emit(self) diff --git a/src/world/world.tscn b/src/world/world.tscn index cedd33b..82b7704 100644 --- a/src/world/world.tscn +++ b/src/world/world.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=8 format=3 uid="uid://cwnwcd8kushl3"] +[gd_scene load_steps=9 format=3 uid="uid://cwnwcd8kushl3"] [ext_resource type="Script" path="res://src/world/world.gd" id="1_ybjyx"] [ext_resource type="PackedScene" uid="uid://bm2o3mex10v11" path="res://levels/debug_level/debug_level.tscn" id="2_0xu5a"] @@ -6,10 +6,11 @@ [ext_resource type="Script" path="res://src/ui/world_ui.gd" id="2_imewa"] [ext_resource type="Resource" uid="uid://crock3revdn73" path="res://src/player/debug_player.tres" id="3_pyw81"] [ext_resource type="Script" path="res://src/world/play_manager/round_robin_manager.gd" id="5_h6mje"] +[ext_resource type="Resource" uid="uid://b5j0lmo4jayk4" path="res://src/player/debug_orange.tres" id="5_ym50e"] [sub_resource type="Resource" id="Resource_rdjhi"] script = ExtResource("5_h6mje") -players = Array[ExtResource("2_e743i")]([ExtResource("3_pyw81")]) +players = Array[ExtResource("2_e743i")]([ExtResource("3_pyw81"), ExtResource("5_ym50e")]) [node name="World" type="Node" groups=["WorldGroup"]] script = ExtResource("1_ybjyx")