Compare commits
No commits in common. "e6fbcbc1aa0bb614b7a253ca3f803dd0d6913373" and "cddbd397656dacad8565c8057b3d882c528d8eb9" have entirely different histories.
e6fbcbc1aa
...
cddbd39765
|
@ -2,20 +2,12 @@ extends Node3D
|
||||||
|
|
||||||
@onready var animation_state: AnimationNodeStateMachinePlayback = $AnimationTree.get("parameters/playback")
|
@onready var animation_state: AnimationNodeStateMachinePlayback = $AnimationTree.get("parameters/playback")
|
||||||
@export var colors: Array[Color]
|
@export var colors: Array[Color]
|
||||||
@onready var color_idx: int = randi()
|
|
||||||
var mat: Material
|
|
||||||
|
|
||||||
func _ready():
|
func _ready():
|
||||||
mat = $Armature/Skeleton3D/Slime.get_active_material(3).duplicate()
|
|
||||||
$Armature/Skeleton3D/Slime.set_surface_override_material(3, mat)
|
|
||||||
var color = colors[randi() % colors.size()]
|
var color = colors[randi() % colors.size()]
|
||||||
mat.albedo_color = color
|
var mat = $Armature/Skeleton3D/Slime.get_active_material(3).duplicate()
|
||||||
|
$Armature/Skeleton3D/Slime.set_surface_override_material(3, mat)
|
||||||
func change_color(idx: int):
|
$Armature/Skeleton3D/Slime.get_active_material(3).albedo_color = color
|
||||||
color_idx = idx % colors.size()
|
|
||||||
var color = colors[color_idx]
|
|
||||||
get_tree().create_tween().tween_property(mat, "albedo_color", color, .3)
|
|
||||||
|
|
||||||
|
|
||||||
func walk():
|
func walk():
|
||||||
animation_state.travel("Walk")
|
animation_state.travel("Walk")
|
||||||
|
|
|
@ -1,24 +1,2 @@
|
||||||
extends SharedSlime
|
extends SharedSlime
|
||||||
class_name Villager
|
class_name Villager
|
||||||
|
|
||||||
var color_changes = true
|
|
||||||
|
|
||||||
func get_color_idx() -> int:
|
|
||||||
return $slime.color_idx
|
|
||||||
|
|
||||||
func _on_area_3d_body_entered(body):
|
|
||||||
if "color_changes" not in body:
|
|
||||||
return
|
|
||||||
var other = body.get_color_idx()
|
|
||||||
var mine = get_color_idx()
|
|
||||||
print(other, mine)
|
|
||||||
if other == mine:
|
|
||||||
return
|
|
||||||
var delta = abs(other - mine)
|
|
||||||
if delta % 2 == 0:
|
|
||||||
if mine < other:
|
|
||||||
$slime.change_color(other)
|
|
||||||
elif mine > other:
|
|
||||||
$slime.change_color(other)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ script = ExtResource("3_a68da")
|
||||||
[node name="Area3D" type="Area3D" parent="Holster"]
|
[node name="Area3D" type="Area3D" parent="Holster"]
|
||||||
|
|
||||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="Holster/Area3D"]
|
[node name="CollisionShape3D" type="CollisionShape3D" parent="Holster/Area3D"]
|
||||||
transform = Transform3D(0.1, 0, 0, 0, 0.1, 0, 0, 0, 0.1, 0, 0, 0)
|
transform = Transform3D(0.1, 0, 0, 0, 0.1, 0, 0, 0, 0.1, 0, 0.0469455, 0)
|
||||||
shape = SubResource("SphereShape3D_6l1w6")
|
shape = SubResource("SphereShape3D_6l1w6")
|
||||||
|
|
||||||
[connection signal="anim_check_grab" from="grape_man" to="." method="_on_grape_man_anim_check_grab"]
|
[connection signal="anim_check_grab" from="grape_man" to="." method="_on_grape_man_anim_check_grab"]
|
||||||
|
|
|
@ -1,17 +1,12 @@
|
||||||
[gd_scene load_steps=4 format=3 uid="uid://c4s6y758n77lw"]
|
[gd_scene load_steps=3 format=3 uid="uid://c4s6y758n77lw"]
|
||||||
|
|
||||||
[ext_resource type="PackedScene" uid="uid://dmtmign72vtlm" path="res://slime_shared.tscn" id="1_qm1jp"]
|
[ext_resource type="PackedScene" uid="uid://dmtmign72vtlm" path="res://slime_shared.tscn" id="1_qm1jp"]
|
||||||
[ext_resource type="Script" path="res://Villager.gd" id="2_uf6mh"]
|
[ext_resource type="Script" path="res://Villager.gd" id="2_uf6mh"]
|
||||||
|
|
||||||
[sub_resource type="SphereShape3D" id="SphereShape3D_0wi6w"]
|
|
||||||
radius = 0.1
|
|
||||||
|
|
||||||
[node name="villager" instance=ExtResource("1_qm1jp")]
|
[node name="villager" instance=ExtResource("1_qm1jp")]
|
||||||
script = ExtResource("2_uf6mh")
|
script = ExtResource("2_uf6mh")
|
||||||
|
walk_chance = 0.1
|
||||||
[node name="Area3D" type="Area3D" parent="." index="2"]
|
spin_chance = 0.2
|
||||||
|
walk_speed = 0.5
|
||||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="Area3D" index="0"]
|
dir_correction_rate = 0.95
|
||||||
shape = SubResource("SphereShape3D_0wi6w")
|
dir_accuracy = 0.00174533
|
||||||
|
|
||||||
[connection signal="body_entered" from="Area3D" to="." method="_on_area_3d_body_entered"]
|
|
||||||
|
|
Loading…
Reference in New Issue