Watch mobile phone

This commit is contained in:
wjsjwr 2024-12-06 23:53:02 +08:00
parent 693392ade9
commit 824e03fabf
15 changed files with 1354 additions and 143 deletions

View File

@ -0,0 +1,34 @@
using Godot;
using System;
[Tool]
public partial class OkToPlayMobilePhone : BTCondition
{
[Export]
public StringName target;
public override Status _Tick(double delta)
{
Student student = Agent as Student; // Cast the agent to a Student object
if (student == null) return Status.Failure;
if (student.State == Student.CharacterState.Idle) {
return Status.Success;
}
if (student.State == Student.CharacterState.Sitting && student.TargetDirection == Student.Direction.Down) {
return Status.Success;
}
return Status.Failure;
}
public override string[] _GetConfigurationWarnings()
{
return Array.Empty<string>();
}
public override string _GenerateName()
{
return "OkToPlayMobilePhone";
}
}

View File

@ -0,0 +1,55 @@
[gd_resource type="BehaviorTree" load_steps=14 format=3 uid="uid://cdsixeqsdfmc1"]
[ext_resource type="Script" path="res://ai/tasks/OkToPlayMobilePhone.cs" id="1_lfwnu"]
[sub_resource type="BlackboardPlan" id="BlackboardPlan_gwwr7"]
[sub_resource type="BTCondition" id="BTCondition_prnjq"]
script = ExtResource("1_lfwnu")
target = null
[sub_resource type="BBNode" id="BBNode_7pcle"]
resource_name = "AnimationPlayer"
saved_value = NodePath("AnimationPlayer")
[sub_resource type="BTPlayAnimation" id="BTPlayAnimation_hx8gl"]
await_completion = 1.2
animation_player = SubResource("BBNode_7pcle")
animation_name = &"phone_up"
[sub_resource type="BBNode" id="BBNode_6275u"]
resource_name = "AnimationPlayer"
saved_value = NodePath("AnimationPlayer")
[sub_resource type="BTPlayAnimation" id="BTPlayAnimation_wbk5l"]
await_completion = 1.0
animation_player = SubResource("BBNode_6275u")
animation_name = &"phone_loop"
[sub_resource type="BTRepeat" id="BTRepeat_1nqee"]
children = [SubResource("BTPlayAnimation_wbk5l")]
times = 3
[sub_resource type="BTProbability" id="BTProbability_x3mt2"]
children = [SubResource("BTRepeat_1nqee")]
run_chance = 0.75
[sub_resource type="BTRepeatUntilFailure" id="BTRepeatUntilFailure_uatr3"]
children = [SubResource("BTProbability_x3mt2")]
[sub_resource type="BBNode" id="BBNode_2433i"]
resource_name = "AnimationPlayer"
saved_value = NodePath("AnimationPlayer")
[sub_resource type="BTPlayAnimation" id="BTPlayAnimation_g4biw"]
await_completion = 0.5
animation_player = SubResource("BBNode_2433i")
animation_name = &"phone_down"
[sub_resource type="BTSequence" id="BTSequence_0drub"]
children = [SubResource("BTCondition_prnjq"), SubResource("BTPlayAnimation_hx8gl"), SubResource("BTRepeatUntilFailure_uatr3"), SubResource("BTPlayAnimation_g4biw")]
[resource]
description = "WatchMobilePhone"
blackboard_plan = SubResource("BlackboardPlan_gwwr7")
root_task = SubResource("BTSequence_0drub")

View File

@ -4,11 +4,14 @@
[ext_resource type="TileSet" uid="uid://doadcdgjrsxxu" path="res://resources/TileSet/Office.tres" id="2_ya2a5"] [ext_resource type="TileSet" uid="uid://doadcdgjrsxxu" path="res://resources/TileSet/Office.tres" id="2_ya2a5"]
[node name="Cube" type="StaticBody2D"] [node name="Cube" type="StaticBody2D"]
y_sort_enabled = true
collision_mask = 3 collision_mask = 3
input_pickable = true input_pickable = true
script = ExtResource("1_3u72b") script = ExtResource("1_3u72b")
[node name="RedBG" type="Polygon2D" parent="."] [node name="RedBG" type="Polygon2D" parent="."]
visible = false
z_index = -1
color = Color(1, 0.0470588, 0.0666667, 0.466667) color = Color(1, 0.0470588, 0.0666667, 0.466667)
polygon = PackedVector2Array(-48, -96, -48, 144, 144, 144, 144, -96) polygon = PackedVector2Array(-48, -96, -48, 144, 144, 144, 144, -96)
@ -17,11 +20,12 @@ tile_map_data = PackedByteArray("AAAAAAAAAAANABwAAAAAAAEAAAANAB0AAAABAAAAAAAOABw
tile_set = ExtResource("2_ya2a5") tile_set = ExtResource("2_ya2a5")
[node name="Desk2" type="TileMapLayer" parent="."] [node name="Desk2" type="TileMapLayer" parent="."]
tile_map_data = PackedByteArray("AAAAAAEAAAAEAB8AAAABAAEAAAAFAB8AAAACAAEAAAAGAB8AAAAAAP//AAAHABwAAAABAP//AAAIABwAAAACAP//AAAJABwAAAA=") z_index = 3
tile_map_data = PackedByteArray("AAAAAP//AAAHABwAAAABAP//AAAIABwAAAACAP//AAAJABwAAAA=")
tile_set = ExtResource("2_ya2a5") tile_set = ExtResource("2_ya2a5")
[node name="Guardrail" type="TileMapLayer" parent="."] [node name="Guardrail" type="TileMapLayer" parent="."]
tile_map_data = PackedByteArray("AAD/////AAAAABoAAAD//wAAAAAAABsAAAD//wEAAAAAABwAAAAAAP//AAABABoAAAAAAAAAAAABABsAAAAAAAEAAAABABwAAAABAP//AAACABoAAAABAAAAAAACABsAAAABAAEAAAACABwAAAACAP//AAADABoAAAACAAAAAAADABsAAAACAAEAAAADABwAAAA=") tile_map_data = PackedByteArray("AAD/////AAAAABoAAAD//wAAAAAAABsAAAD//wEAAAAAABwAAAAAAP//AAABABoAAAAAAAAAAAABABsAAAAAAAEAAAABABwAAAABAAAAAAACABsAAAABAAEAAAACABwAAAACAP//AAADABoAAAACAAAAAAADABsAAAACAAEAAAADABwAAAA=")
tile_set = ExtResource("2_ya2a5") tile_set = ExtResource("2_ya2a5")
[node name="Desk" type="TileMapLayer" parent="."] [node name="Desk" type="TileMapLayer" parent="."]
@ -29,16 +33,20 @@ tile_map_data = PackedByteArray("AAAAAAAAAAAEAB4AAAAAAAEAAAAEAB8AAAABAAAAAAAFAB4
tile_set = ExtResource("2_ya2a5") tile_set = ExtResource("2_ya2a5")
[node name="Equip" type="TileMapLayer" parent="."] [node name="Equip" type="TileMapLayer" parent="."]
z_index = 1
tile_map_data = PackedByteArray("AAABAAAAAAAIACAAAAABAAEAAAAIACEAAAAAAAAAAAALABMAAAAAAAEAAAALABQAAAACAAAAAAAJACAAAAACAAEAAAAJACEAAAA=") tile_map_data = PackedByteArray("AAABAAAAAAAIACAAAAABAAEAAAAIACEAAAAAAAAAAAALABMAAAAAAAEAAAALABQAAAACAAAAAAAJACAAAAACAAEAAAAJACEAAAA=")
tile_set = ExtResource("2_ya2a5") tile_set = ExtResource("2_ya2a5")
[node name="Equip2" type="TileMapLayer" parent="."] [node name="Equip2" type="TileMapLayer" parent="."]
z_index = 4
tile_map_data = PackedByteArray("AAABAP//AAAOACAAAAACAP//AAAPAB4AAAAAAP//AAANACAAAAA=") tile_map_data = PackedByteArray("AAABAP//AAAOACAAAAACAP//AAAPAB4AAAAAAP//AAANACAAAAA=")
tile_set = ExtResource("2_ya2a5") tile_set = ExtResource("2_ya2a5")
[node name="Chair" type="TileMapLayer" parent="."] [node name="Chair" type="TileMapLayer" parent="."]
z_index = 5
tile_map_data = PackedByteArray("AAABAAEAAAABAAgAAAABAAIAAAABAAkAAAA=") tile_map_data = PackedByteArray("AAABAAEAAAABAAgAAAABAAIAAAABAAkAAAA=")
tile_set = ExtResource("2_ya2a5") tile_set = ExtResource("2_ya2a5")
[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="."] [node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="."]
visible = false
polygon = PackedVector2Array(48, 138, 97, 138, 97, 97, 144, 97, 144, -33, 97, -33, 97, -76, 48, -76, 48, -33, -10, -33, -10, 97, 48, 97) polygon = PackedVector2Array(48, 138, 97, 138, 97, 97, 144, 97, 144, -33, 97, -33, 97, -76, 48, -76, 48, -33, -10, -33, -10, 97, 48, 97)

View File

@ -555,6 +555,7 @@ sources/0 = SubResource("TileSetAtlasSource_fufp2")
sources/1 = SubResource("TileSetAtlasSource_nuiiq") sources/1 = SubResource("TileSetAtlasSource_nuiiq")
[node name="Lab" type="Node2D"] [node name="Lab" type="Node2D"]
y_sort_enabled = true
script = ExtResource("1_xcxd5") script = ExtResource("1_xcxd5")
[node name="OutGround" type="TileMapLayer" parent="."] [node name="OutGround" type="TileMapLayer" parent="."]
@ -583,11 +584,11 @@ collision_visibility_mode = 1
script = ExtResource("3_mca7j") script = ExtResource("3_mca7j")
[node name="Student" parent="." instance=ExtResource("8_wqdny")] [node name="Student" parent="." instance=ExtResource("8_wqdny")]
position = Vector2(24, 192) position = Vector2(24, 168)
[node name="BottomBar" parent="." instance=ExtResource("10_1ep8g")] [node name="BottomBar" parent="." instance=ExtResource("10_1ep8g")]
offset_top = 1028.0 offset_top = 1028.0
offset_bottom = 1028.0 offset_bottom = 1028.0
[node name="Cube" parent="." instance=ExtResource("8_04hci")] [node name="Cube" parent="." instance=ExtResource("8_04hci")]
position = Vector2(942.001, 460.001) position = Vector2(566, 271)

View File

@ -3,6 +3,21 @@
[ext_resource type="Texture2D" uid="uid://dxqtqlu4rkew7" path="res://resources/logo/bbj.png" id="1_al3ug"] [ext_resource type="Texture2D" uid="uid://dxqtqlu4rkew7" path="res://resources/logo/bbj.png" id="1_al3ug"]
[ext_resource type="Script" path="res://scripts/LogoScene.cs" id="1_dx6qu"] [ext_resource type="Script" path="res://scripts/LogoScene.cs" id="1_dx6qu"]
[sub_resource type="Animation" id="Animation_2c4eo"]
length = 0.001
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("BbjLogo/Sprite2D:modulate")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [Color(1, 1, 1, 0)]
}
[sub_resource type="Animation" id="Animation_6umjc"] [sub_resource type="Animation" id="Animation_6umjc"]
resource_name = "logo_show" resource_name = "logo_show"
length = 3.0 length = 3.0
@ -20,21 +35,6 @@ tracks/0/keys = {
"values": [Color(1, 1, 1, 0), Color(1, 1, 1, 1), Color(1, 1, 1, 1), Color(1, 1, 1, 0)] "values": [Color(1, 1, 1, 0), Color(1, 1, 1, 1), Color(1, 1, 1, 1), Color(1, 1, 1, 0)]
} }
[sub_resource type="Animation" id="Animation_2c4eo"]
length = 0.001
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("BbjLogo/Sprite2D:modulate")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 0,
"values": [Color(1, 1, 1, 0)]
}
[sub_resource type="AnimationLibrary" id="AnimationLibrary_sun07"] [sub_resource type="AnimationLibrary" id="AnimationLibrary_sun07"]
_data = { _data = {
"RESET": SubResource("Animation_2c4eo"), "RESET": SubResource("Animation_2c4eo"),

View File

@ -1,8 +1,9 @@
[gd_scene load_steps=13 format=3 uid="uid://c413oatj0eqhu"] [gd_scene load_steps=42 format=3 uid="uid://c413oatj0eqhu"]
[ext_resource type="Script" path="res://scripts/Student.cs" id="1_oesea"] [ext_resource type="Script" path="res://scripts/Student.cs" id="1_oesea"]
[ext_resource type="Texture2D" uid="uid://bw2007qd8eedh" path="res://resources/characters/bodies/Body_48x48_01.png" id="3_jhea4"] [ext_resource type="Texture2D" uid="uid://bw2007qd8eedh" path="res://resources/characters/bodies/Body_48x48_01.png" id="3_jhea4"]
[ext_resource type="Script" path="res://scripts/StudentName.cs" id="8_kvqca"] [ext_resource type="Script" path="res://scripts/StudentName.cs" id="8_kvqca"]
[ext_resource type="BehaviorTree" uid="uid://cdsixeqsdfmc1" path="res://ai/watch_mobile_phone.tres" id="9_m1j2m"]
[ext_resource type="Texture2D" uid="uid://c5or8ivaegryg" path="res://resources/characters/accessories/Accessory_06_Policeman_Hat_48x48_01.png" id="30_npp82"] [ext_resource type="Texture2D" uid="uid://c5or8ivaegryg" path="res://resources/characters/accessories/Accessory_06_Policeman_Hat_48x48_01.png" id="30_npp82"]
[ext_resource type="Texture2D" uid="uid://ylt6r0ottjkn" path="res://resources/characters/eyes/Eyes_48x48_01.png" id="96_q8xrp"] [ext_resource type="Texture2D" uid="uid://ylt6r0ottjkn" path="res://resources/characters/eyes/Eyes_48x48_01.png" id="96_q8xrp"]
[ext_resource type="Texture2D" uid="uid://dnqrj6tcfn7rb" path="res://resources/characters/hairstyles/Hairstyle_01_48x48_01.png" id="103_yndn4"] [ext_resource type="Texture2D" uid="uid://dnqrj6tcfn7rb" path="res://resources/characters/hairstyles/Hairstyle_01_48x48_01.png" id="103_yndn4"]
@ -14,6 +15,144 @@ size = Vector2(48, 96)
[sub_resource type="Animation" id="Animation_f0f87"] [sub_resource type="Animation" id="Animation_f0f87"]
length = 0.001 length = 0.001
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("parts/body:frame_coords")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [Vector2i(18, 2)]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("parts/hairstyle:frame_coords")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [Vector2i(18, 2)]
}
tracks/2/type = "value"
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/path = NodePath("parts/outfit:frame_coords")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [Vector2i(18, 2)]
}
tracks/3/type = "value"
tracks/3/imported = false
tracks/3/enabled = true
tracks/3/path = NodePath("parts/eye:frame_coords")
tracks/3/interp = 1
tracks/3/loop_wrap = true
tracks/3/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [Vector2i(18, 1)]
}
tracks/4/type = "value"
tracks/4/imported = false
tracks/4/enabled = true
tracks/4/path = NodePath("parts/accessory:frame_coords")
tracks/4/interp = 1
tracks/4/loop_wrap = true
tracks/4/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [Vector2i(19, 2)]
}
tracks/5/type = "value"
tracks/5/imported = false
tracks/5/enabled = true
tracks/5/path = NodePath("parts/smartphone:frame_coords")
tracks/5/interp = 1
tracks/5/loop_wrap = true
tracks/5/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [Vector2i(0, 6)]
}
[sub_resource type="Animation" id="Animation_poc5q"]
resource_name = "idle_back"
length = 0.6
loop_mode = 1
step = 0.1
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("parts/body:frame_coords")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 0.1, 0.2, 0.3, 0.4, 0.5),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1),
"update": 1,
"values": [Vector2i(6, 1), Vector2i(7, 1), Vector2i(8, 1), Vector2i(9, 1), Vector2i(10, 1), Vector2i(11, 1)]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("parts/hairstyle:frame_coords")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0, 0.1, 0.2, 0.3, 0.4, 0.5),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1),
"update": 1,
"values": [Vector2i(6, 1), Vector2i(7, 1), Vector2i(8, 1), Vector2i(9, 1), Vector2i(10, 1), Vector2i(11, 1)]
}
tracks/2/type = "value"
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/path = NodePath("parts/outfit:frame_coords")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/keys = {
"times": PackedFloat32Array(0, 0.1, 0.2, 0.3, 0.4, 0.5),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1),
"update": 1,
"values": [Vector2i(6, 1), Vector2i(7, 1), Vector2i(8, 1), Vector2i(9, 1), Vector2i(10, 1), Vector2i(11, 1)]
}
tracks/3/type = "value"
tracks/3/imported = false
tracks/3/enabled = true
tracks/3/path = NodePath("parts/eye:frame_coords")
tracks/3/interp = 1
tracks/3/loop_wrap = true
tracks/3/keys = {
"times": PackedFloat32Array(0, 0.1, 0.2, 0.3, 0.4, 0.5),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1),
"update": 1,
"values": [Vector2i(6, 1), Vector2i(7, 1), Vector2i(8, 1), Vector2i(9, 1), Vector2i(10, 1), Vector2i(11, 1)]
}
tracks/4/type = "value"
tracks/4/imported = false
tracks/4/enabled = true
tracks/4/path = NodePath("parts/accessory:frame_coords")
tracks/4/interp = 1
tracks/4/loop_wrap = true
tracks/4/keys = {
"times": PackedFloat32Array(0, 0.1, 0.2, 0.3, 0.4, 0.5),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1),
"update": 1,
"values": [Vector2i(6, 1), Vector2i(7, 1), Vector2i(8, 1), Vector2i(9, 1), Vector2i(10, 1), Vector2i(11, 1)]
}
[sub_resource type="Animation" id="Animation_bptvv"] [sub_resource type="Animation" id="Animation_bptvv"]
resource_name = "idle_front" resource_name = "idle_front"
@ -93,63 +232,770 @@ tracks/5/keys = {
"values": [Vector2i(18, 1), Vector2i(19, 1), Vector2i(20, 1), Vector2i(21, 1), Vector2i(22, 1), Vector2i(23, 1)] "values": [Vector2i(18, 1), Vector2i(19, 1), Vector2i(20, 1), Vector2i(21, 1), Vector2i(22, 1), Vector2i(23, 1)]
} }
[sub_resource type="Animation" id="Animation_p6nlo"]
resource_name = "idle_left"
length = 0.6
loop_mode = 1
step = 0.1
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("parts/body:frame_coords")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 0.1, 0.2, 0.3, 0.4, 0.5),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1),
"update": 1,
"values": [Vector2i(12, 1), Vector2i(13, 1), Vector2i(14, 1), Vector2i(15, 1), Vector2i(16, 1), Vector2i(17, 1)]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("parts/hairstyle:frame_coords")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0, 0.1, 0.2, 0.3, 0.4, 0.5),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1),
"update": 1,
"values": [Vector2i(12, 1), Vector2i(13, 1), Vector2i(14, 1), Vector2i(15, 1), Vector2i(16, 1), Vector2i(17, 1)]
}
tracks/2/type = "value"
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/path = NodePath("parts/outfit:frame_coords")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/keys = {
"times": PackedFloat32Array(0, 0.1, 0.2, 0.3, 0.4, 0.5),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1),
"update": 1,
"values": [Vector2i(12, 1), Vector2i(13, 1), Vector2i(14, 1), Vector2i(15, 1), Vector2i(16, 1), Vector2i(17, 1)]
}
tracks/3/type = "value"
tracks/3/imported = false
tracks/3/enabled = true
tracks/3/path = NodePath("parts/eye:frame_coords")
tracks/3/interp = 1
tracks/3/loop_wrap = true
tracks/3/keys = {
"times": PackedFloat32Array(0, 0.1, 0.2, 0.3, 0.4, 0.5),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1),
"update": 1,
"values": [Vector2i(12, 1), Vector2i(13, 1), Vector2i(14, 1), Vector2i(15, 1), Vector2i(16, 1), Vector2i(17, 1)]
}
tracks/4/type = "value"
tracks/4/imported = false
tracks/4/enabled = true
tracks/4/path = NodePath("parts/accessory:frame_coords")
tracks/4/interp = 1
tracks/4/loop_wrap = true
tracks/4/keys = {
"times": PackedFloat32Array(0, 0.1, 0.2, 0.3, 0.4, 0.5),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1),
"update": 1,
"values": [Vector2i(6, 1), Vector2i(7, 1), Vector2i(8, 1), Vector2i(9, 1), Vector2i(10, 1), Vector2i(11, 1)]
}
[sub_resource type="Animation" id="Animation_a1x0t"]
resource_name = "idle_right"
length = 0.6
loop_mode = 1
step = 0.1
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("parts/body:frame_coords")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 0.1, 0.2, 0.3, 0.4, 0.5),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1),
"update": 1,
"values": [Vector2i(0, 1), Vector2i(1, 1), Vector2i(2, 1), Vector2i(3, 1), Vector2i(4, 1), Vector2i(5, 1)]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("parts/hairstyle:frame_coords")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0, 0.1, 0.2, 0.3, 0.4, 0.5),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1),
"update": 1,
"values": [Vector2i(0, 1), Vector2i(1, 1), Vector2i(2, 1), Vector2i(3, 1), Vector2i(4, 1), Vector2i(5, 1)]
}
tracks/2/type = "value"
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/path = NodePath("parts/outfit:frame_coords")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/keys = {
"times": PackedFloat32Array(0, 0.1, 0.2, 0.3, 0.4, 0.5),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1),
"update": 1,
"values": [Vector2i(0, 1), Vector2i(1, 1), Vector2i(2, 1), Vector2i(3, 1), Vector2i(4, 1), Vector2i(5, 1)]
}
tracks/3/type = "value"
tracks/3/imported = false
tracks/3/enabled = true
tracks/3/path = NodePath("parts/eye:frame_coords")
tracks/3/interp = 1
tracks/3/loop_wrap = true
tracks/3/keys = {
"times": PackedFloat32Array(0, 0.1, 0.2, 0.3, 0.4, 0.5),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1),
"update": 1,
"values": [Vector2i(0, 1), Vector2i(1, 1), Vector2i(2, 1), Vector2i(3, 1), Vector2i(4, 1), Vector2i(5, 1)]
}
tracks/4/type = "value"
tracks/4/imported = false
tracks/4/enabled = true
tracks/4/path = NodePath("parts/accessory:frame_coords")
tracks/4/interp = 1
tracks/4/loop_wrap = true
tracks/4/keys = {
"times": PackedFloat32Array(0, 0.1, 0.2, 0.3, 0.4, 0.5),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1),
"update": 1,
"values": [Vector2i(0, 1), Vector2i(1, 1), Vector2i(2, 1), Vector2i(3, 1), Vector2i(4, 1), Vector2i(5, 1)]
}
[sub_resource type="Animation" id="Animation_uladi"]
resource_name = "phone_down"
length = 0.3
step = 0.1
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("parts/body:frame_coords")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 0.1, 0.2),
"transitions": PackedFloat32Array(1, 1, 1),
"update": 1,
"values": [Vector2i(9, 6), Vector2i(10, 6), Vector2i(11, 6)]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("parts/hairstyle:frame_coords")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0, 0.1, 0.2),
"transitions": PackedFloat32Array(1, 1, 1),
"update": 1,
"values": [Vector2i(9, 6), Vector2i(10, 6), Vector2i(11, 6)]
}
tracks/2/type = "value"
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/path = NodePath("parts/outfit:frame_coords")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/keys = {
"times": PackedFloat32Array(0, 0.1, 0.2),
"transitions": PackedFloat32Array(1, 1, 1),
"update": 1,
"values": [Vector2i(9, 6), Vector2i(10, 6), Vector2i(11, 6)]
}
tracks/3/type = "value"
tracks/3/imported = false
tracks/3/enabled = true
tracks/3/path = NodePath("parts/eye:frame_coords")
tracks/3/interp = 1
tracks/3/loop_wrap = true
tracks/3/keys = {
"times": PackedFloat32Array(0, 0.1, 0.2),
"transitions": PackedFloat32Array(1, 1, 1),
"update": 1,
"values": [Vector2i(9, 6), Vector2i(10, 6), Vector2i(11, 6)]
}
tracks/4/type = "value"
tracks/4/imported = false
tracks/4/enabled = true
tracks/4/path = NodePath("parts/accessory:frame_coords")
tracks/4/interp = 1
tracks/4/loop_wrap = true
tracks/4/keys = {
"times": PackedFloat32Array(0, 0.1, 0.2),
"transitions": PackedFloat32Array(1, 1, 1),
"update": 1,
"values": [Vector2i(9, 6), Vector2i(10, 6), Vector2i(11, 6)]
}
tracks/5/type = "value"
tracks/5/imported = false
tracks/5/enabled = true
tracks/5/path = NodePath("parts/smartphone:frame_coords")
tracks/5/interp = 1
tracks/5/loop_wrap = true
tracks/5/keys = {
"times": PackedFloat32Array(0, 0.1, 0.2),
"transitions": PackedFloat32Array(1, 1, 1),
"update": 1,
"values": [Vector2i(9, 6), Vector2i(10, 6), Vector2i(11, 6)]
}
[sub_resource type="Animation" id="Animation_m8rfw"]
resource_name = "phone_loop"
length = 0.6
step = 0.1
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("parts/body:frame_coords")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 0.1, 0.2, 0.3, 0.4, 0.5),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1),
"update": 1,
"values": [Vector2i(3, 6), Vector2i(4, 6), Vector2i(5, 6), Vector2i(6, 6), Vector2i(7, 6), Vector2i(8, 6)]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("parts/hairstyle:frame_coords")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0, 0.1, 0.2, 0.3, 0.4, 0.5),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1),
"update": 1,
"values": [Vector2i(3, 6), Vector2i(4, 6), Vector2i(5, 6), Vector2i(6, 6), Vector2i(7, 6), Vector2i(8, 6)]
}
tracks/2/type = "value"
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/path = NodePath("parts/outfit:frame_coords")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/keys = {
"times": PackedFloat32Array(0, 0.1, 0.2, 0.3, 0.4, 0.5),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1),
"update": 1,
"values": [Vector2i(3, 6), Vector2i(4, 6), Vector2i(5, 6), Vector2i(6, 6), Vector2i(7, 6), Vector2i(8, 6)]
}
tracks/3/type = "value"
tracks/3/imported = false
tracks/3/enabled = true
tracks/3/path = NodePath("parts/eye:frame_coords")
tracks/3/interp = 1
tracks/3/loop_wrap = true
tracks/3/keys = {
"times": PackedFloat32Array(0, 0.1, 0.2, 0.3, 0.4, 0.5),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1),
"update": 1,
"values": [Vector2i(3, 6), Vector2i(4, 6), Vector2i(5, 6), Vector2i(6, 6), Vector2i(7, 6), Vector2i(8, 6)]
}
tracks/4/type = "value"
tracks/4/imported = false
tracks/4/enabled = true
tracks/4/path = NodePath("parts/accessory:frame_coords")
tracks/4/interp = 1
tracks/4/loop_wrap = true
tracks/4/keys = {
"times": PackedFloat32Array(0, 0.1, 0.2, 0.3, 0.4, 0.5),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1),
"update": 1,
"values": [Vector2i(3, 6), Vector2i(4, 6), Vector2i(5, 6), Vector2i(6, 6), Vector2i(7, 6), Vector2i(8, 6)]
}
tracks/5/type = "value"
tracks/5/imported = false
tracks/5/enabled = true
tracks/5/path = NodePath("parts/smartphone:frame_coords")
tracks/5/interp = 1
tracks/5/loop_wrap = true
tracks/5/keys = {
"times": PackedFloat32Array(0, 0.1, 0.2, 0.3, 0.4, 0.5),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1),
"update": 1,
"values": [Vector2i(3, 6), Vector2i(4, 6), Vector2i(5, 6), Vector2i(6, 6), Vector2i(7, 6), Vector2i(8, 6)]
}
[sub_resource type="Animation" id="Animation_qv1ib"]
resource_name = "phone_up"
length = 0.9
step = 0.1
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("parts/body:frame_coords")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1, 1, 1, 1),
"update": 1,
"values": [Vector2i(0, 6), Vector2i(1, 6), Vector2i(2, 6), Vector2i(3, 6), Vector2i(4, 6), Vector2i(5, 6), Vector2i(6, 6), Vector2i(7, 6), Vector2i(8, 6)]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("parts/hairstyle:frame_coords")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1, 1, 1, 1),
"update": 1,
"values": [Vector2i(0, 6), Vector2i(1, 6), Vector2i(2, 6), Vector2i(3, 6), Vector2i(4, 6), Vector2i(5, 6), Vector2i(6, 6), Vector2i(7, 6), Vector2i(8, 6)]
}
tracks/2/type = "value"
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/path = NodePath("parts/outfit:frame_coords")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/keys = {
"times": PackedFloat32Array(0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1, 1, 1, 1),
"update": 1,
"values": [Vector2i(0, 6), Vector2i(1, 6), Vector2i(2, 6), Vector2i(3, 6), Vector2i(4, 6), Vector2i(5, 6), Vector2i(6, 6), Vector2i(7, 6), Vector2i(8, 6)]
}
tracks/3/type = "value"
tracks/3/imported = false
tracks/3/enabled = true
tracks/3/path = NodePath("parts/eye:frame_coords")
tracks/3/interp = 1
tracks/3/loop_wrap = true
tracks/3/keys = {
"times": PackedFloat32Array(0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1, 1, 1, 1),
"update": 1,
"values": [Vector2i(0, 6), Vector2i(1, 6), Vector2i(2, 6), Vector2i(3, 6), Vector2i(4, 6), Vector2i(5, 6), Vector2i(6, 6), Vector2i(7, 6), Vector2i(8, 6)]
}
tracks/4/type = "value"
tracks/4/imported = false
tracks/4/enabled = true
tracks/4/path = NodePath("parts/accessory:frame_coords")
tracks/4/interp = 1
tracks/4/loop_wrap = true
tracks/4/keys = {
"times": PackedFloat32Array(0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1, 1, 1, 1),
"update": 1,
"values": [Vector2i(0, 6), Vector2i(1, 6), Vector2i(2, 6), Vector2i(3, 6), Vector2i(4, 6), Vector2i(5, 6), Vector2i(6, 6), Vector2i(7, 6), Vector2i(8, 6)]
}
tracks/5/type = "value"
tracks/5/imported = false
tracks/5/enabled = true
tracks/5/path = NodePath("parts/smartphone:frame_coords")
tracks/5/interp = 1
tracks/5/loop_wrap = true
tracks/5/keys = {
"times": PackedFloat32Array(0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1, 1, 1, 1),
"update": 1,
"values": [Vector2i(0, 6), Vector2i(1, 6), Vector2i(2, 6), Vector2i(3, 6), Vector2i(4, 6), Vector2i(5, 6), Vector2i(6, 6), Vector2i(7, 6), Vector2i(8, 6)]
}
[sub_resource type="Animation" id="Animation_kvk6q"]
resource_name = "walk_down"
length = 0.6
loop_mode = 1
step = 0.1
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("parts/body:frame_coords")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 0.1, 0.2, 0.3, 0.4, 0.5),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1),
"update": 1,
"values": [Vector2i(18, 2), Vector2i(19, 2), Vector2i(20, 2), Vector2i(21, 2), Vector2i(22, 2), Vector2i(23, 2)]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("parts/hairstyle:frame_coords")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0, 0.1, 0.2, 0.3, 0.4, 0.5),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1),
"update": 1,
"values": [Vector2i(18, 2), Vector2i(19, 2), Vector2i(20, 2), Vector2i(21, 2), Vector2i(22, 2), Vector2i(23, 2)]
}
tracks/2/type = "value"
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/path = NodePath("parts/outfit:frame_coords")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/keys = {
"times": PackedFloat32Array(0, 0.1, 0.2, 0.3, 0.4, 0.5),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1),
"update": 1,
"values": [Vector2i(18, 2), Vector2i(19, 2), Vector2i(20, 2), Vector2i(21, 2), Vector2i(22, 2), Vector2i(23, 2)]
}
tracks/3/type = "value"
tracks/3/imported = false
tracks/3/enabled = true
tracks/3/path = NodePath("parts/eye:frame_coords")
tracks/3/interp = 1
tracks/3/loop_wrap = true
tracks/3/keys = {
"times": PackedFloat32Array(0, 0.1, 0.2, 0.3, 0.4, 0.5),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1),
"update": 1,
"values": [Vector2i(18, 2), Vector2i(19, 2), Vector2i(20, 2), Vector2i(21, 2), Vector2i(22, 2), Vector2i(23, 2)]
}
tracks/4/type = "value"
tracks/4/imported = false
tracks/4/enabled = true
tracks/4/path = NodePath("parts/accessory:frame_coords")
tracks/4/interp = 1
tracks/4/loop_wrap = true
tracks/4/keys = {
"times": PackedFloat32Array(0, 0.1, 0.2, 0.3, 0.4, 0.5),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1),
"update": 1,
"values": [Vector2i(18, 2), Vector2i(19, 2), Vector2i(20, 2), Vector2i(21, 2), Vector2i(22, 2), Vector2i(23, 2)]
}
[sub_resource type="Animation" id="Animation_cu2c1"]
resource_name = "walk_left"
length = 0.6
loop_mode = 1
step = 0.1
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("parts/body:frame_coords")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 0.1, 0.2, 0.3, 0.4, 0.5),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1),
"update": 1,
"values": [Vector2i(12, 2), Vector2i(13, 2), Vector2i(14, 2), Vector2i(15, 2), Vector2i(16, 2), Vector2i(17, 2)]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("parts/hairstyle:frame_coords")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0, 0.1, 0.2, 0.3, 0.4, 0.5),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1),
"update": 1,
"values": [Vector2i(12, 2), Vector2i(13, 2), Vector2i(14, 2), Vector2i(15, 2), Vector2i(16, 2), Vector2i(17, 2)]
}
tracks/2/type = "value"
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/path = NodePath("parts/outfit:frame_coords")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/keys = {
"times": PackedFloat32Array(0, 0.1, 0.2, 0.3, 0.4, 0.5),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1),
"update": 1,
"values": [Vector2i(12, 2), Vector2i(13, 2), Vector2i(14, 2), Vector2i(15, 2), Vector2i(16, 2), Vector2i(17, 2)]
}
tracks/3/type = "value"
tracks/3/imported = false
tracks/3/enabled = true
tracks/3/path = NodePath("parts/eye:frame_coords")
tracks/3/interp = 1
tracks/3/loop_wrap = true
tracks/3/keys = {
"times": PackedFloat32Array(0, 0.1, 0.2, 0.3, 0.4, 0.5),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1),
"update": 1,
"values": [Vector2i(12, 2), Vector2i(13, 2), Vector2i(14, 2), Vector2i(15, 2), Vector2i(16, 2), Vector2i(17, 2)]
}
tracks/4/type = "value"
tracks/4/imported = false
tracks/4/enabled = true
tracks/4/path = NodePath("parts/accessory:frame_coords")
tracks/4/interp = 1
tracks/4/loop_wrap = true
tracks/4/keys = {
"times": PackedFloat32Array(0, 0.1, 0.2, 0.3, 0.4, 0.5),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1),
"update": 1,
"values": [Vector2i(12, 2), Vector2i(13, 2), Vector2i(14, 2), Vector2i(15, 2), Vector2i(16, 2), Vector2i(17, 2)]
}
[sub_resource type="Animation" id="Animation_v0rmi"]
resource_name = "walk_right"
length = 0.6
loop_mode = 1
step = 0.1
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("parts/body:frame_coords")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 0.1, 0.2, 0.3, 0.4, 0.5),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1),
"update": 1,
"values": [Vector2i(0, 2), Vector2i(1, 2), Vector2i(2, 2), Vector2i(3, 2), Vector2i(4, 2), Vector2i(5, 2)]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("parts/hairstyle:frame_coords")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0, 0.1, 0.2, 0.3, 0.4, 0.5),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1),
"update": 1,
"values": [Vector2i(0, 2), Vector2i(1, 2), Vector2i(2, 2), Vector2i(3, 2), Vector2i(4, 2), Vector2i(5, 2)]
}
tracks/2/type = "value"
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/path = NodePath("parts/outfit:frame_coords")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/keys = {
"times": PackedFloat32Array(0, 0.1, 0.2, 0.3, 0.4, 0.5),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1),
"update": 1,
"values": [Vector2i(0, 2), Vector2i(1, 2), Vector2i(2, 2), Vector2i(3, 2), Vector2i(4, 2), Vector2i(5, 2)]
}
tracks/3/type = "value"
tracks/3/imported = false
tracks/3/enabled = true
tracks/3/path = NodePath("parts/eye:frame_coords")
tracks/3/interp = 1
tracks/3/loop_wrap = true
tracks/3/keys = {
"times": PackedFloat32Array(0, 0.1, 0.2, 0.3, 0.4, 0.5),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1),
"update": 1,
"values": [Vector2i(0, 2), Vector2i(1, 2), Vector2i(2, 2), Vector2i(3, 2), Vector2i(4, 2), Vector2i(5, 2)]
}
tracks/4/type = "value"
tracks/4/imported = false
tracks/4/enabled = true
tracks/4/path = NodePath("parts/accessory:frame_coords")
tracks/4/interp = 1
tracks/4/loop_wrap = true
tracks/4/keys = {
"times": PackedFloat32Array(0, 0.1, 0.2, 0.3, 0.4, 0.5),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1),
"update": 1,
"values": [Vector2i(0, 2), Vector2i(1, 2), Vector2i(2, 2), Vector2i(3, 2), Vector2i(4, 2), Vector2i(5, 2)]
}
[sub_resource type="Animation" id="Animation_q6d3e"]
resource_name = "walk_up"
length = 0.6
loop_mode = 1
step = 0.1
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("parts/body:frame_coords")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0, 0.1, 0.2, 0.3, 0.4, 0.5),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1),
"update": 1,
"values": [Vector2i(6, 2), Vector2i(7, 2), Vector2i(8, 2), Vector2i(9, 2), Vector2i(10, 2), Vector2i(11, 2)]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("parts/hairstyle:frame_coords")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0, 0.1, 0.2, 0.3, 0.4, 0.5),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1),
"update": 1,
"values": [Vector2i(6, 2), Vector2i(7, 2), Vector2i(8, 2), Vector2i(9, 2), Vector2i(10, 2), Vector2i(11, 2)]
}
tracks/2/type = "value"
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/path = NodePath("parts/outfit:frame_coords")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/keys = {
"times": PackedFloat32Array(0, 0.1, 0.2, 0.3, 0.4, 0.5),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1),
"update": 1,
"values": [Vector2i(6, 2), Vector2i(7, 2), Vector2i(8, 2), Vector2i(9, 2), Vector2i(10, 2), Vector2i(11, 2)]
}
tracks/3/type = "value"
tracks/3/imported = false
tracks/3/enabled = true
tracks/3/path = NodePath("parts/eye:frame_coords")
tracks/3/interp = 1
tracks/3/loop_wrap = true
tracks/3/keys = {
"times": PackedFloat32Array(0, 0.1, 0.2, 0.3, 0.4, 0.5),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1),
"update": 1,
"values": [Vector2i(6, 2), Vector2i(7, 2), Vector2i(8, 2), Vector2i(9, 2), Vector2i(10, 2), Vector2i(11, 2)]
}
tracks/4/type = "value"
tracks/4/imported = false
tracks/4/enabled = true
tracks/4/path = NodePath("parts/accessory:frame_coords")
tracks/4/interp = 1
tracks/4/loop_wrap = true
tracks/4/keys = {
"times": PackedFloat32Array(0, 0.1, 0.2, 0.3, 0.4, 0.5),
"transitions": PackedFloat32Array(1, 1, 1, 1, 1, 1),
"update": 1,
"values": [Vector2i(6, 2), Vector2i(7, 2), Vector2i(8, 2), Vector2i(9, 2), Vector2i(10, 2), Vector2i(11, 2)]
}
[sub_resource type="AnimationLibrary" id="AnimationLibrary_fw47y"] [sub_resource type="AnimationLibrary" id="AnimationLibrary_fw47y"]
_data = { _data = {
"RESET": SubResource("Animation_f0f87"), "RESET": SubResource("Animation_f0f87"),
"idle_front": SubResource("Animation_bptvv") "idle_back": SubResource("Animation_poc5q"),
"idle_front": SubResource("Animation_bptvv"),
"idle_left": SubResource("Animation_p6nlo"),
"idle_right": SubResource("Animation_a1x0t"),
"phone_down": SubResource("Animation_uladi"),
"phone_loop": SubResource("Animation_m8rfw"),
"phone_up": SubResource("Animation_qv1ib"),
"walk_down": SubResource("Animation_kvk6q"),
"walk_left": SubResource("Animation_cu2c1"),
"walk_right": SubResource("Animation_v0rmi"),
"walk_up": SubResource("Animation_q6d3e")
} }
[sub_resource type="BlackboardPlan" id="BlackboardPlan_46g5k"]
var/OkToPlayMobilePhone/name = &"OkToPlayMobilePhone"
var/OkToPlayMobilePhone/type = 1
var/OkToPlayMobilePhone/value = false
var/OkToPlayMobilePhone/hint = 0
var/OkToPlayMobilePhone/hint_string = ""
[sub_resource type="BBNode" id="BBNode_1jlqh"]
resource_name = "."
saved_value = NodePath(".")
[sub_resource type="BTCallMethod" id="BTCallMethod_4w245"]
node = SubResource("BBNode_1jlqh")
method = &"GoTo"
[sub_resource type="BTRandomWait" id="BTRandomWait_0f45u"]
min_duration = 5.0
max_duration = 8.0
[sub_resource type="BlackboardPlan" id="BlackboardPlan_id04c"]
[sub_resource type="BTSubtree" id="BTSubtree_fuxrk"]
blackboard_plan = SubResource("BlackboardPlan_id04c")
subtree = ExtResource("9_m1j2m")
[sub_resource type="BTSequence" id="BTSequence_5y0as"]
children = [SubResource("BTCallMethod_4w245"), SubResource("BTRandomWait_0f45u"), SubResource("BTSubtree_fuxrk")]
metadata/_weight_ = 1.0
[sub_resource type="BBNode" id="BBNode_c6axb"]
resource_name = "."
saved_value = NodePath(".")
[sub_resource type="BTCallMethod" id="BTCallMethod_gu2qw"]
node = SubResource("BBNode_c6axb")
method = &"GoToSeat"
[sub_resource type="BTRandomWait" id="BTRandomWait_el8uw"]
min_duration = 5.0
max_duration = 8.0
[sub_resource type="BTSubtree" id="BTSubtree_y8so2"]
blackboard_plan = SubResource("BlackboardPlan_id04c")
subtree = ExtResource("9_m1j2m")
[sub_resource type="BBNode" id="BBNode_uxlnw"]
resource_name = "."
saved_value = NodePath(".")
[sub_resource type="BTCallMethod" id="BTCallMethod_vxdpx"]
node = SubResource("BBNode_uxlnw")
method = &"GoTo"
[sub_resource type="BTRandomWait" id="BTRandomWait_nwe3t"]
min_duration = 5.0
max_duration = 8.0
[sub_resource type="BTSequence" id="BTSequence_1ad6t"]
children = [SubResource("BTCallMethod_gu2qw"), SubResource("BTRandomWait_el8uw"), SubResource("BTSubtree_y8so2"), SubResource("BTCallMethod_vxdpx"), SubResource("BTRandomWait_nwe3t")]
metadata/_weight_ = 4.0
[sub_resource type="BTProbabilitySelector" id="BTProbabilitySelector_w3hpi"]
children = [SubResource("BTSequence_5y0as"), SubResource("BTSequence_1ad6t")]
[sub_resource type="BehaviorTree" id="BehaviorTree_bf6dw"]
blackboard_plan = SubResource("BlackboardPlan_46g5k")
root_task = SubResource("BTProbabilitySelector_w3hpi")
[sub_resource type="BlackboardPlan" id="BlackboardPlan_qtgr4"]
[node name="Student" type="CharacterBody2D"] [node name="Student" type="CharacterBody2D"]
z_index = 2
script = ExtResource("1_oesea") script = ExtResource("1_oesea")
[node name="CollisionShape2D" type="CollisionShape2D" parent="."] [node name="CollisionShape2D" type="CollisionShape2D" parent="."]
position = Vector2(0, -48) position = Vector2(0, -24)
shape = SubResource("RectangleShape2D_opr6h") shape = SubResource("RectangleShape2D_opr6h")
[node name="parts" type="Node2D" parent="."] [node name="parts" type="Node2D" parent="."]
position = Vector2(0, -24)
[node name="body" type="Sprite2D" parent="parts"] [node name="body" type="Sprite2D" parent="parts"]
position = Vector2(0, -24) position = Vector2(0, -24)
texture = ExtResource("3_jhea4") texture = ExtResource("3_jhea4")
hframes = 26 hframes = 26
vframes = 8 vframes = 8
frame = 45 frame = 70
[node name="hairstyle" type="Sprite2D" parent="parts"] [node name="hairstyle" type="Sprite2D" parent="parts"]
position = Vector2(0, -24) position = Vector2(0, -24)
texture = ExtResource("103_yndn4") texture = ExtResource("103_yndn4")
hframes = 26 hframes = 26
vframes = 8 vframes = 8
frame = 45 frame = 70
[node name="outfit" type="Sprite2D" parent="parts"] [node name="outfit" type="Sprite2D" parent="parts"]
position = Vector2(0, -24) position = Vector2(0, -24)
texture = ExtResource("303_jwwbg") texture = ExtResource("303_jwwbg")
hframes = 26 hframes = 26
vframes = 8 vframes = 8
frame = 45 frame = 70
[node name="eye" type="Sprite2D" parent="parts"] [node name="eye" type="Sprite2D" parent="parts"]
position = Vector2(0, -24) position = Vector2(0, -24)
texture = ExtResource("96_q8xrp") texture = ExtResource("96_q8xrp")
hframes = 26 hframes = 26
vframes = 8 vframes = 8
frame = 45 frame = 44
[node name="accessory" type="Sprite2D" parent="parts"] [node name="accessory" type="Sprite2D" parent="parts"]
position = Vector2(0, -24) position = Vector2(0, -24)
texture = ExtResource("30_npp82") texture = ExtResource("30_npp82")
hframes = 26 hframes = 26
vframes = 8 vframes = 8
frame = 45 frame = 71
[node name="smartphone" type="Sprite2D" parent="parts"] [node name="smartphone" type="Sprite2D" parent="parts"]
position = Vector2(0, -24) position = Vector2(0, -24)
texture = ExtResource("435_7vwql") texture = ExtResource("435_7vwql")
hframes = 26 hframes = 26
vframes = 8 vframes = 8
frame = 45 frame = 156
[node name="AnimationPlayer" type="AnimationPlayer" parent="."] [node name="AnimationPlayer" type="AnimationPlayer" parent="."]
libraries = { libraries = {
@ -158,3 +1004,7 @@ libraries = {
[node name="StudentName" type="Node" parent="."] [node name="StudentName" type="Node" parent="."]
script = ExtResource("8_kvqca") script = ExtResource("8_kvqca")
[node name="BTPlayer" type="BTPlayer" parent="."]
behavior_tree = SubResource("BehaviorTree_bf6dw")
blackboard_plan = SubResource("BlackboardPlan_qtgr4")

View File

@ -0,0 +1,37 @@
# meta-name: Custom Task
# meta-description: Custom task to be used in a BehaviorTree
# meta-default: true
@tool
extends _BASE_
## _CLASS_
# Display a customized name (requires @tool).
func _generate_name() -> String:
_TS_return "_CLASS_"
# Called once during initialization.
func _setup() -> void:
_TS_pass
# Called each time this task is entered.
func _enter() -> void:
_TS_pass
# Called each time this task is exited.
func _exit() -> void:
_TS_pass
# Called each time this task is ticked (aka executed).
func _tick(delta: float) -> Status:
_TS_return SUCCESS
# Strings returned from this method are displayed as warnings in the behavior tree editor (requires @tool).
func _get_configuration_warnings() -> PackedStringArray:
_TS_var warnings := PackedStringArray()
_TS_return warnings

View File

@ -1,6 +1,8 @@
using Godot; using Godot;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using System.Xml;
public partial class Cube : StaticBody2D, ITileDraggable public partial class Cube : StaticBody2D, ITileDraggable
{ {
@ -83,6 +85,9 @@ public partial class Cube : StaticBody2D, ITileDraggable
} }
} }
private readonly Guid _id = Guid.NewGuid();
public Guid ID => _id;
public Vector2I TilePosition { get; set; } = new Vector2I(5,5); public Vector2I TilePosition { get; set; } = new Vector2I(5,5);
private bool _isCollided = true; private bool _isCollided = true;
public bool IsCollided { public bool IsCollided {
@ -103,9 +108,15 @@ public partial class Cube : StaticBody2D, ITileDraggable
private Vector2I _mouseOffset; private Vector2I _mouseOffset;
public Vector2I MouseOffset => _mouseOffset; public Vector2I MouseOffset => _mouseOffset;
private static readonly ITileDraggable.SpecialTile[] _specialTiles = {
new(new Vector2I(1,-1), Lab.MapNodeType.SeatDown | Lab.MapNodeType.Walkable),
new(new Vector2I(1,2), Lab.MapNodeType.SeatUp | Lab.MapNodeType.Walkable),
};
public ITileDraggable.SpecialTile[] SpecialTiles => _specialTiles;
// Called when the node enters the scene tree for the first time. // Called when the node enters the scene tree for the first time.
public override void _Ready() public override void _Ready()
{ {
RandomChangeTheme(); RandomChangeTheme();
@ -117,16 +128,15 @@ public partial class Cube : StaticBody2D, ITileDraggable
if (@event.IsActionPressed("mouse_left_press")) { if (@event.IsActionPressed("mouse_left_press")) {
if (Draggable) { if (Draggable) {
var parent = GetParent<Lab>(); var parent = GetParent<Lab>();
parent.IsDragging = true; parent.Pickup(this);
parent.DraggingTarget = this;
var desk = GetNode<TileMapLayer>("Desk"); var desk = GetNode<TileMapLayer>("Desk");
_mouseOffset = desk.LocalToMap(GetLocalMousePosition()); _mouseOffset = desk.LocalToMap(GetLocalMousePosition());
GD.Print($"_mouseOffset = {_mouseOffset}"); GD.Print($"_mouseOffset = {_mouseOffset}");
} }
} else if (@event.IsActionReleased("mouse_left_press")) { } else if (@event.IsActionReleased("mouse_left_press")) {
if (_isCollided) return;
var parent = GetParent<Lab>(); var parent = GetParent<Lab>();
parent.IsDragging = false; parent.PutDown(this);
parent.DraggingTarget = null;
} }
base._InputEvent(viewport, @event, shapeIdx); base._InputEvent(viewport, @event, shapeIdx);
} }
@ -137,14 +147,53 @@ public partial class Cube : StaticBody2D, ITileDraggable
GlobalPosition = TilePosition * 48; GlobalPosition = TilePosition * 48;
} }
private int tableThemeIdx;
private int table2ThemeIdx;
private int chairThemeIdx;
private int chair2ThemeIdx;
private int equipThemeIdx;
private int equip2ThemeIdx;
public void RandomChangeTheme() { public void RandomChangeTheme() {
tableThemes[GD.RandRange(0, tableThemes.Length-1)].Apply(GetNode<TileMapLayer>("Desk")); tableThemeIdx = GD.RandRange(0, tableThemes.Length-1);
table2Themes[GD.RandRange(0, table2Themes.Length-1)].Apply(GetNode<TileMapLayer>("Desk2")); chairThemeIdx = GD.RandRange(0, chairThemes.Length-1);
chairThemes[GD.RandRange(0, chairThemes.Length-1)].Apply(GetNode<TileMapLayer>("Chair")); equipThemeIdx = GD.RandRange(0, equipThemes.Length-1);
chair2Themes[GD.RandRange(0, chair2Themes.Length-1)].Apply(GetNode<TileMapLayer>("Chair2"));
equipThemes[GD.RandRange(0, equipThemes.Length-1)].Apply(GetNode<TileMapLayer>("Equip")); table2ThemeIdx = GD.RandRange(0, table2Themes.Length-1);
var x =GD.RandRange(0, equip2Themes.Length-1); chair2ThemeIdx = GD.RandRange(0, chair2Themes.Length-1);
GD.Print(GD.RandRange(0, equip2Themes.Length-1)); equip2ThemeIdx = GD.RandRange(0, equip2Themes.Length-1);
equip2Themes[x].Apply(GetNode<TileMapLayer>("Equip2"));
tableThemes[tableThemeIdx].Apply(GetNode<TileMapLayer>("Desk"));
chairThemes[chairThemeIdx].Apply(GetNode<TileMapLayer>("Chair"));
equipThemes[equipThemeIdx].Apply(GetNode<TileMapLayer>("Equip"));
table2Themes[table2ThemeIdx].Apply(GetNode<TileMapLayer>("Desk2"));
chair2Themes[chair2ThemeIdx].Apply(GetNode<TileMapLayer>("Chair2"));
equip2Themes[equip2ThemeIdx].Apply(GetNode<TileMapLayer>("Equip2"));
} }
private static readonly HashSet<Vector2I> blockerTiles = new(new Vector2I[]{
new(0,0),
new(1,0),
new(2,0),
new(0,1),
new(1,1),
new(2,1),
});
public Lab.MapNodeType GetTileType(Vector2I pos)
{
GD.Print($"query position of {pos}");
if (blockerTiles.Contains(pos)) {
return Lab.MapNodeType.Blocker;
}
if (_specialTiles.Any(t => t.Position == pos)) {
return _specialTiles.First(t => t.Position == pos).NodeType;
}
return Lab.MapNodeType.Walkable;
}
public void ChairFaceTo(Vector2I target, int idx) {
if (idx == 0) {
var theme = chairThemes[chairThemeIdx];
}
}
} }

View File

@ -20,4 +20,6 @@ public partial class GameManager : Node
{ {
} }
} }

16
scripts/Helpers.cs Normal file
View File

@ -0,0 +1,16 @@
using Godot;
public class H {
public static bool RectHasPointInclusive(Rect2I r, Vector2I p) {
if (r.HasPoint(p)) {
return true;
}
if (r.End.Y == p.Y && p.X >= r.Position.X && p.X <= r.End.X) {
return true;
}
if (r.End.X == p.X && p.Y >= r.Position.Y && p.Y <= r.End.Y) {
return true;
}
return false;
}
}

27
scripts/ITileDraggable.cs Normal file
View File

@ -0,0 +1,27 @@
using System;
using System.Diagnostics.SymbolStore;
using System.Dynamic;
using Godot;
public interface ITileDraggable {
Vector2I TilePosition { get; set; }
bool Draggable { get; set; }
bool IsCollided { get; set; }
Rect2I TileRect { get; }
Vector2I MouseOffset { get; }
SpecialTile[] SpecialTiles { get; }
class SpecialTile {
public readonly Vector2I Position;
public readonly Lab.MapNodeType NodeType;
public SpecialTile(Vector2I pos, Lab.MapNodeType node) {
Position = pos;
NodeType = node;
}
}
Lab.MapNodeType GetTileType(Vector2I pos);
Guid ID { get; }
}

View File

@ -5,6 +5,16 @@ using System.Linq;
public partial class Lab : Node2D public partial class Lab : Node2D
{ {
[Flags]
public enum MapNodeType
{
Invalid = 0,
Walkable = 1,
Wall = 2,
Blocker = 4,
SeatUp = 8,
SeatDown = 16,
}
private static readonly Rect2I[] wallRectangles = { private static readonly Rect2I[] wallRectangles = {
new(0,0,40,2), new(0,0,40,2),
new(0,5,1, 15), new(0,5,1, 15),
@ -12,6 +22,9 @@ public partial class Lab : Node2D
new(39,2,1,18), new(39,2,1,18),
}; };
private readonly Dictionary<Guid, ITileDraggable> furnitureIDs = new();
public Dictionary<Guid, ITileDraggable> Furniture => furnitureIDs;
// Called when the node enters the scene tree for the first time. // Called when the node enters the scene tree for the first time.
public override void _Ready() public override void _Ready()
{ {
@ -20,17 +33,26 @@ public partial class Lab : Node2D
Player.Timeline.Subscribe(DateOnly.Parse("2024/11/20"), Guid.NewGuid()); Player.Timeline.Subscribe(DateOnly.Parse("2024/11/20"), Guid.NewGuid());
Player.Timeline.OnEventTriggered += (d, e) => GD.Print($"Timeline event triggered: {d}, {e}"); Player.Timeline.OnEventTriggered += (d, e) => GD.Print($"Timeline event triggered: {d}, {e}");
var label = GetNode<Label>("BottomBar/HBoxContainer/Date"); var label = GetNode<Label>("BottomBar/HBoxContainer/Date");
label.Text = Player.Timeline.InternalDate.ToLongDateString(); label.Text = Player.Timeline.InternalDate.ToLongDateString();
Player.Timeline.OnDayChanged += d => label.Text = d.ToLongDateString(); Player.Timeline.OnDayChanged += d => label.Text = d.ToLongDateString();
var table = GetNode<Cube>("Cube"); var table = GetNode<Cube>("Cube");
Player.Timeline.OnDayChanged += d => table.RandomChangeTheme();
table.Draggable = true; table.Draggable = true;
MoneyLabel = GetNode<Label>("BottomBar/HBoxContainer/Money"); MoneyLabel = GetNode<Label>("BottomBar/HBoxContainer/Money");
var rect = table.TileRect;
rect.Position += table.TilePosition;
furniturePlacement.Add(rect, table);
furnitureIDs.Add(table.ID, table);
tileMap = GetNode<TileMapLayer>("OutGround"); tileMap = GetNode<TileMapLayer>("OutGround");
UpdateMap(); UpdateMap();
var student = GetNode<Student>("Student");
student.CubeId = table.ID;
var r = new Rect2I(0,0,1,1);
GD.Print(H.RectHasPointInclusive(r, new Vector2I(1,0)));
} }
private Label MoneyLabel = null; private Label MoneyLabel = null;
@ -49,7 +71,7 @@ public partial class Lab : Node2D
break; break;
} }
MoneyLabel.Text = Player.Budget.Total.ToString("N0"); MoneyLabel.Text = Player.Budget.Total.ToString("N0");
if (IsDragging && DraggingTarget != null) { if (_isDragging && DraggingTarget != null) {
Vector2 mousePos = GetLocalMousePosition(); Vector2 mousePos = GetLocalMousePosition();
Vector2I cell = Point2Coord(mousePos) - DraggingTarget.MouseOffset; Vector2I cell = Point2Coord(mousePos) - DraggingTarget.MouseOffset;
var targetRect = DraggingTarget.TileRect; var targetRect = DraggingTarget.TileRect;
@ -59,31 +81,31 @@ public partial class Lab : Node2D
} }
} }
public bool IsDragging { get; set; } = false; private bool _isDragging = false;
public ITileDraggable DraggingTarget { get; set; } = null; public void Pickup(ITileDraggable target) {
if (target == null) return;
private static readonly Vector2I tableTileCoord = new(0, 6); _isDragging = true;
private static readonly Vector2I waterTileCoord = new(6, 9); DraggingTarget = target;
private static readonly Vector2I doorTileCoord = new(9, 3);
private static readonly Vector2I axeTileCoord = new(10, 9);
private static readonly Vector2I blockTileCoord = new(4, 3);
public enum MapNodeType
{
Table,
Water,
Door,
Axe,
Block,
Road,
} }
public void PutDown(ITileDraggable target) {
if (target == null) return;
_isDragging = false;
furniturePlacement.Remove(furniturePlacement.First(kv => kv.Value == target).Key);
var rect = target.TileRect;
rect.Position += target.TilePosition;
furniturePlacement.Add(rect, target);
DraggingTarget = null;
UpdateMap();
}
public ITileDraggable DraggingTarget { get; set; } = null;
private const int MAP_WIDTH = 24; public const int MAP_WIDTH = 40;
private const int MAP_HEIGHT = 13; public const int MAP_HEIGHT = 21;
private readonly MapNodeType[,] blocks = new MapNodeType[MAP_WIDTH, MAP_HEIGHT]; private readonly MapNodeType[,] blocks = new MapNodeType[MAP_WIDTH, MAP_HEIGHT];
private Dictionary<Rect2I, ITileDraggable> furniturePlacement = new ();
private TileMapLayer tileMap; private TileMapLayer tileMap;
@ -91,19 +113,20 @@ public partial class Lab : Node2D
{ {
for (int i = 0; i < MAP_WIDTH; i++) { for (int i = 0; i < MAP_WIDTH; i++) {
for (int j = 0; j < MAP_HEIGHT; j++) { for (int j = 0; j < MAP_HEIGHT; j++) {
var tile = tileMap.GetCellAtlasCoords(new Vector2I(i,j)); Vector2I vec = new (i,j);
if (tile == tableTileCoord) { if (wallRectangles.Any(w => w.HasPoint(vec))) {
blocks[i,j] = MapNodeType.Table; blocks[i, j] = MapNodeType.Wall;
} else if (tile == waterTileCoord) { } else if (furniturePlacement.Any(f => f.Key.HasPoint(vec))) {
blocks[i,j] = MapNodeType.Water; MapNodeType t = 0;
} else if (tile == doorTileCoord) { foreach (var kv in furniturePlacement.Where(f => f.Key.HasPoint(vec))) {
blocks[i,j] = MapNodeType.Door; t |= kv.Value.GetTileType(vec - kv.Value.TilePosition);
} else if (tile == axeTileCoord) { }
blocks[i,j] = MapNodeType.Axe; if ((t & MapNodeType.Walkable) != 0 && (t & MapNodeType.Blocker) != 0){
} else if (tile == blockTileCoord) { t ^= MapNodeType.Walkable;
blocks[i,j] = MapNodeType.Block; }
blocks[i ,j] = t;
} else { } else {
blocks[i,j] = MapNodeType.Road; blocks[i, j] = MapNodeType.Walkable;
} }
} }
} }
@ -128,16 +151,16 @@ public partial class Lab : Node2D
return neighbor; return neighbor;
} }
if (IsValidPosition(new Vector2I(x-1,y)) && blocks[x-1,y] == MapNodeType.Road) { if (IsValidPosition(new Vector2I(x-1,y)) && (blocks[x-1,y] & MapNodeType.Walkable) == MapNodeType.Walkable) {
neighbor.Add(new Vector2I(x-1,y)); neighbor.Add(new Vector2I(x-1,y));
} }
if (IsValidPosition(new Vector2I(x+1,y)) && blocks[x+1,y] == MapNodeType.Road) { if (IsValidPosition(new Vector2I(x+1,y)) && (blocks[x+1,y] & MapNodeType.Walkable) == MapNodeType.Walkable) {
neighbor.Add(new Vector2I(x+1,y)); neighbor.Add(new Vector2I(x+1,y));
} }
if (IsValidPosition(new Vector2I(x,y-1)) && blocks[x,y-1] == MapNodeType.Road) { if (IsValidPosition(new Vector2I(x,y-1)) && (blocks[x,y-1] & MapNodeType.Walkable) == MapNodeType.Walkable) {
neighbor.Add(new Vector2I(x,y-1)); neighbor.Add(new Vector2I(x,y-1));
} }
if (IsValidPosition(new Vector2I(x,y+1)) && blocks[x,y+1] == MapNodeType.Road) { if (IsValidPosition(new Vector2I(x,y+1)) && (blocks[x,y+1] & MapNodeType.Walkable) == MapNodeType.Walkable) {
neighbor.Add(new Vector2I(x,y+1)); neighbor.Add(new Vector2I(x,y+1));
} }
return neighbor; return neighbor;
@ -148,7 +171,13 @@ public partial class Lab : Node2D
for (int j = 0; j < MAP_HEIGHT; j++) { for (int j = 0; j < MAP_HEIGHT; j++) {
string t = ""; string t = "";
for (int i = 0; i < MAP_WIDTH; i++) { for (int i = 0; i < MAP_WIDTH; i++) {
t += $"{blocks[i,j]} "; if ((blocks[i,j] & MapNodeType.SeatUp) != 0) {
t += "U";
} else if ((blocks[i,j] & MapNodeType.SeatDown) != 0) {
t += "D";
} else {
t += $"{blocks[i,j].ToString()[0]}";
}
} }
GD.Print(t); GD.Print(t);
} }
@ -159,8 +188,7 @@ public partial class Lab : Node2D
if (start == end) { if (start == end) {
return path; return path;
} }
GD.Print(start); GD.Print($"start = {start}, end = {end}");
GD.Print(end);
static int vec2idx(Vector2I v) => v.Y * MAP_WIDTH + v.X; static int vec2idx(Vector2I v) => v.Y * MAP_WIDTH + v.X;
static Vector2I idx2vec2(int i) => new(i % MAP_WIDTH, i / MAP_WIDTH); static Vector2I idx2vec2(int i) => new(i % MAP_WIDTH, i / MAP_WIDTH);
@ -194,7 +222,6 @@ public partial class Lab : Node2D
u = j; u = j;
} }
} }
GD.Print($"u={u}");
if (u == -1) { if (u == -1) {
return path; return path;
} }
@ -205,15 +232,12 @@ public partial class Lab : Node2D
visited[u] = true; visited[u] = true;
var neighbors = GetNeighbors(idx2vec2(u)); var neighbors = GetNeighbors(idx2vec2(u));
int alt = dist[u] + 1; int alt = dist[u] + 1;
GD.Print($"Alt={alt}");
foreach (var neighbor in neighbors) { foreach (var neighbor in neighbors) {
int idx = vec2idx(neighbor); int idx = vec2idx(neighbor);
if (visited[idx]) continue; if (visited[idx]) continue;
GD.Print($"Neighbor: {neighbor}, id={idx}, dist={dist[idx]}");
if (alt < dist[idx]) { if (alt < dist[idx]) {
dist[idx] = alt; dist[idx] = alt;
prev[idx] = u; prev[idx] = u;
GD.Print($"Prev({idx}) = {u}");
} }
} }
} }
@ -223,34 +247,30 @@ public partial class Lab : Node2D
answer = prev[answer]; answer = prev[answer];
} }
path.Reverse(); path.Reverse();
GD.Print(string.Join(',', path));
return path; return path;
} }
public Vector2I GetTypedBlock(MapNodeType nType, uint idx) { public Vector2I GetTypedBlock(MapNodeType nType, uint idx) {
Vector2I tileCoord;
switch(nType) { switch(nType) {
case MapNodeType.Table:
tileCoord = tableTileCoord;
break;
case MapNodeType.Water:
tileCoord = waterTileCoord;
break;
case MapNodeType.Door:
tileCoord = doorTileCoord;
break;
case MapNodeType.Axe:
tileCoord = axeTileCoord;
break;
default: default:
return Vector2I.Zero; return Vector2I.Zero;
} }
var candidates = tileMap.GetUsedCellsById(0, tileCoord, -1); }
idx %= (uint)candidates.Count;
return candidates[(int)idx]; public MapNodeType GetMapNodeTypeOfPosition(Vector2I pos) {
if (!IsValidPosition(pos)) return MapNodeType.Invalid;
return blocks[pos.X, pos.Y];
} }
public Vector2I Point2Coord(Vector2 pos) { public Vector2I Point2Coord(Vector2 pos) {
return tileMap.LocalToMap(tileMap.ToLocal(pos)); return tileMap.LocalToMap(tileMap.ToLocal(pos));
} }
public Vector2I GetFurSpecialPosition(Guid fID, int idx) {
if (!furnitureIDs.ContainsKey(fID)) return Vector2I.Zero;
if (idx < 0 || idx > furnitureIDs[fID].SpecialTiles.Length) return Vector2I.Zero;
return furnitureIDs[fID].SpecialTiles[idx].Position + furnitureIDs[fID].TilePosition;
}
} }

View File

@ -84,9 +84,6 @@ public partial class Res : Node
"res://resources/characters/accessories/Accessory_08_Detective_Hat_48x48_01.png", "res://resources/characters/accessories/Accessory_08_Detective_Hat_48x48_01.png",
"res://resources/characters/accessories/Accessory_08_Detective_Hat_48x48_02.png", "res://resources/characters/accessories/Accessory_08_Detective_Hat_48x48_02.png",
"res://resources/characters/accessories/Accessory_08_Detective_Hat_48x48_03.png", "res://resources/characters/accessories/Accessory_08_Detective_Hat_48x48_03.png",
"res://resources/characters/accessories/Accessory_09_Zombie_Brain_48x48_01.png",
"res://resources/characters/accessories/Accessory_09_Zombie_Brain_48x48_02.png",
"res://resources/characters/accessories/Accessory_09_Zombie_Brain_48x48_03.png",
"res://resources/characters/accessories/Accessory_10_Bolt_48x48_01.png", "res://resources/characters/accessories/Accessory_10_Bolt_48x48_01.png",
"res://resources/characters/accessories/Accessory_10_Bolt_48x48_02.png", "res://resources/characters/accessories/Accessory_10_Bolt_48x48_02.png",
"res://resources/characters/accessories/Accessory_10_Bolt_48x48_03.png", "res://resources/characters/accessories/Accessory_10_Bolt_48x48_03.png",

View File

@ -1,45 +1,97 @@
using Godot; using Godot;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
public partial class Student : CharacterBody2D public partial class Student : CharacterBody2D
{ {
public float Speed { get; set; } = 10.0f; public float Speed { get; set; } = 8.0f;
public const float JumpVelocity = -400.0f; public const float JumpVelocity = -400.0f;
public int NextType = -1; public int NextType = -1;
private Queue<Vector2I> PathToGo = new(); private Queue<Vector2I> PathToGo = new();
private AnimationPlayer animationPlayer;
public enum CharacterState { Idle, Walking, Sitting, SittingDown, StandingUp }
public CharacterState State { get; set; } = CharacterState.Idle;
public enum Direction { Up, Down, Left, Right }
public Direction TargetDirection { get; set; } = Direction.Up;
public Queue<CharacterState> StateQueue { get; set; } = new();
private Vector2I targetSpecialPosition;
private Vector2I lastWalkablePosition;
private double duration = 0;
private void SitDown(double delta) {
duration += delta;
if (duration > 0.3) {
if (TargetDirection == Direction.Up) {
}
animationPlayer.Play("idle_front");
State = StateQueue.Dequeue();
GlobalPosition = targetSpecialPosition;
}
}
private void GettingUp(double delta) {
duration += delta;
if (duration > 0.3) {
State = StateQueue.Dequeue();
GlobalPosition = lastWalkablePosition;
}
}
public override void _PhysicsProcess(double delta) public override void _PhysicsProcess(double delta)
{ {
if (StateQueue.Count > 0) {
// GD.Print($"{State} -> {StateQueue.Peek()}");
if (StateQueue.Peek() == CharacterState.Sitting && State == CharacterState.SittingDown) {
SitDown(delta);
return; // do not handle potentially conflicting command
}
if (StateQueue.Peek() == CharacterState.StandingUp && State == CharacterState.Sitting) {
duration = 0;
State = StateQueue.Dequeue();
return;
}
if (StateQueue.Peek() == CharacterState.Walking && State == CharacterState.StandingUp) {
GettingUp(delta);
return;
}
} else {
// GD.Print($"{State} -> Empty");
}
if (PathToGo.Count == 0) if (PathToGo.Count == 0)
{ {
if (State == CharacterState.Walking) {
if (StateQueue.Count > 0) {
if (StateQueue.Peek() == CharacterState.SittingDown) {
duration = 0;
}
State = StateQueue.Dequeue();
}
if (State == CharacterState.Idle) {
animationPlayer.Play("idle_front");
}
}
return;// No path to follow. return;// No path to follow.
} }
if (State != CharacterState.Walking) return;
Vector2 velocity = new(); Vector2 velocity = new();
var nextPoint = PathToGo.Peek(); var nextPoint = PathToGo.Peek();
if ((int)GlobalPosition.X == nextPoint.X && (int)GlobalPosition.Y == nextPoint.Y) if ((int)GlobalPosition.X == nextPoint.X && (int)GlobalPosition.Y == nextPoint.Y)
{ {
GD.Print(PathToGo.Dequeue()); PathToGo.Dequeue();
return; return;
} }
// if ((int)GlobalPosition.X == nextPoint.X) {
// // Move Y
// // velocity.Y = Math.Max(Speed, Math.Abs(nextPoint.Y - GlobalPosition.Y));
// velocity.Y = Speed;
// if (GlobalPosition.Y > nextPoint.Y) {
// velocity.Y = -velocity.Y;
// }
// } else if ((int)GlobalPosition.Y == nextPoint.Y) {
// // move X
// // velocity.X = Math.Max(Speed, Math.Abs(nextPoint.X - GlobalPosition.X));
// velocity.X = Speed;
// if (GlobalPosition.X > nextPoint.X) {
// velocity.X = -velocity.X;
// }
// }
if ((int)GlobalPosition.X == nextPoint.X) if ((int)GlobalPosition.X == nextPoint.X)
{ {
// Move Y // Move Y
@ -47,7 +99,10 @@ public partial class Student : CharacterBody2D
velocity.Y = Speed; velocity.Y = Speed;
if (GlobalPosition.Y > nextPoint.Y) if (GlobalPosition.Y > nextPoint.Y)
{ {
animationPlayer.Play("walk_up");
velocity.Y = -velocity.Y; velocity.Y = -velocity.Y;
} else {
animationPlayer.Play("walk_down");
} }
} }
else if ((int)GlobalPosition.Y == nextPoint.Y) else if ((int)GlobalPosition.Y == nextPoint.Y)
@ -57,7 +112,11 @@ public partial class Student : CharacterBody2D
velocity.X = Speed; velocity.X = Speed;
if (GlobalPosition.X > nextPoint.X) if (GlobalPosition.X > nextPoint.X)
{ {
animationPlayer.Play("walk_left");
velocity.X = -velocity.X; velocity.X = -velocity.X;
} else {
animationPlayer.Play("walk_right");
} }
} }
GlobalPosition = GlobalPosition with GlobalPosition = GlobalPosition with
@ -66,8 +125,10 @@ public partial class Student : CharacterBody2D
Y = GlobalPosition.Y + velocity.Y Y = GlobalPosition.Y + velocity.Y
}; };
// GD.Print($"{GlobalPosition} -> {nextPoint}");
// Velocity = velocity; // Velocity = velocity;
MoveAndSlide(); // MoveAndSlide();
} }
public override void _Ready() public override void _Ready()
@ -78,8 +139,8 @@ public partial class Student : CharacterBody2D
// bb.BindVarToProperty("Stayed", this, "Speed"); // bb.BindVarToProperty("Stayed", this, "Speed");
// GD.Print(bb.GetVar("Stayed")); // GD.Print(bb.GetVar("Stayed"));
// GD.Print($"Speed: {Speed}"); // GD.Print($"Speed: {Speed}");
var ap = GetNode<AnimationPlayer>("AnimationPlayer"); animationPlayer = GetNode<AnimationPlayer>("AnimationPlayer");
ap.Play("idle_front"); animationPlayer.Play("idle_front");
var name_test = GetNode<StudentName>("StudentName"); var name_test = GetNode<StudentName>("StudentName");
GD.Print("生成的名字是: " + name_test.GenerateName()); GD.Print("生成的名字是: " + name_test.GenerateName());
} }
@ -88,20 +149,84 @@ public partial class Student : CharacterBody2D
{ {
foreach (var p in path) foreach (var p in path)
{ {
PathToGo.Enqueue(new Vector2I(p.X * 80 + 40, p.Y * 80 + 120)); PathToGo.Enqueue(new Vector2I(p.X * 48 + 24, p.Y * 48 + 24));
} }
} }
public void GoTo(int nType) public Guid CubeId;
public void GoTo() {
if (State == CharacterState.SittingDown || State == CharacterState.StandingUp || State == CharacterState.Walking)
{ {
GD.Print($"Called with nType = {nType}"); return;
}
var lab = GetParentOrNull<Lab>(); var lab = GetParentOrNull<Lab>();
if (lab == null) if (lab == null)
{ {
return; return;
} }
var block = lab.GetTypedBlock((Lab.MapNodeType)nType, GD.Randi()); Vector2I vec = Vector2I.Zero;
MoveFollowPath(lab.GetShortestPath(lab.Point2Coord(GlobalPosition), block)); while ((lab.GetMapNodeTypeOfPosition(vec) & Lab.MapNodeType.Walkable) == 0) {
vec.X = GD.RandRange(0, Lab.MAP_WIDTH);
vec.Y = GD.RandRange(0, Lab.MAP_HEIGHT);
}
var pos = GlobalPosition;
if (State == CharacterState.Sitting) {
StateQueue.Enqueue(CharacterState.StandingUp);
StateQueue.Enqueue(CharacterState.Walking);
pos = lastWalkablePosition;
} else if (State == CharacterState.Idle) {
State = CharacterState.Walking;
}
StateQueue.Enqueue(CharacterState.Idle);
MoveFollowPath(lab.GetShortestPath(lab.Point2Coord(pos), vec));
randomChangeBody();
}
public void GoToSeat() {
if (State == CharacterState.SittingDown || State == CharacterState.StandingUp || State == CharacterState.Walking)
{
return;
}
var lab = GetParentOrNull<Lab>();
if (lab == null)
{
return;
}
var i = GD.RandRange(0,1);
var target = lab.GetFurSpecialPosition(CubeId, i);
if (i == 1) {
// Seat up
TargetDirection = Direction.Up;
targetSpecialPosition = new Vector2I(target.X * 48 + 24, target.Y * 48 + 12);
} else {
TargetDirection = Direction.Down;
targetSpecialPosition = new Vector2I(target.X * 48 + 24, target.Y * 48 + 18);
}
var pos = GlobalPosition;
if (State == CharacterState.Sitting) {
StateQueue.Enqueue(CharacterState.StandingUp);
StateQueue.Enqueue(CharacterState.Walking);
pos = lastWalkablePosition;
} else if (State == CharacterState.Idle) {
State = CharacterState.Walking;
}
StateQueue.Enqueue(CharacterState.SittingDown);
StateQueue.Enqueue(CharacterState.Sitting);
var path = lab.GetShortestPath(lab.Point2Coord(pos), target);
lastWalkablePosition = new Vector2I(path.Last().X * 48 + 24, path.Last().Y * 48 + 24);
// if (lastWalkablePosition.X < targetSpecialPosition.X) {
// TargetDirection = Direction.Right;
// } else if (lastWalkablePosition.X > targetSpecialPosition.X) {
// TargetDirection = Direction.Left;
// } else {
// if (lastWalkablePosition.Y < targetSpecialPosition.Y) {
// TargetDirection = Direction.Up;
// } else if (lastWalkablePosition.Y > targetSpecialPosition.Y) {
// TargetDirection = Direction.Down;
// }
// }
MoveFollowPath(path);
randomChangeBody(); randomChangeBody();
} }

View File

@ -1,10 +0,0 @@
using Godot;
public interface ITileDraggable {
Vector2I TilePosition { get; set; }
bool Draggable { get; set; }
bool IsCollided { get; set; }
Rect2I TileRect { get; }
Vector2I MouseOffset { get; }
}