diff --git a/addons/resources_spreadsheet_view/saved_state.json b/addons/resources_spreadsheet_view/saved_state.json index a4f1e53..b0d0679 100644 --- a/addons/resources_spreadsheet_view/saved_state.json +++ b/addons/resources_spreadsheet_view/saved_state.json @@ -4,6 +4,13 @@ "resource_local_to_scene": true, "resource_name": true }, + "res://config/player_skill/": { + "animation_name": true, + "has_animation": true, + "resource_local_to_scene": true, + "resource_name": true, + "sprite_frams": true + }, "res://example/Items/items/": { "resource_local_to_scene": true, "resource_name": true @@ -11,7 +18,8 @@ }, "recent_paths": [ "res://example/Items/items/", - "res://config/character/" + "res://config/character/", + "res://config/player_skill/" ], "table_functions": { "filter": [ diff --git a/config/attack/normal.tres b/config/attack/normal.tres new file mode 100644 index 0000000..22de861 --- /dev/null +++ b/config/attack/normal.tres @@ -0,0 +1,14 @@ +[gd_resource type="Resource" script_class="AttackCfg" load_steps=2 format=3 uid="uid://bsqk3q6mccllg"] + +[ext_resource type="Script" path="res://script/config/attack_cfg.gd" id="1_wn06b"] + +[resource] +script = ExtResource("1_wn06b") +damage_rate = 1.0 +break_level = 0 +hit_back_speed = 0.0 +hit_back_duration = 0.0 +hit_up_speed = 0.0 +hit_up_duration = 0.0 +pause_time = 0.0 +is_floating = false diff --git a/config/character/monster01.tres b/config/character/monster01.tres index 6120037..3db677d 100644 --- a/config/character/monster01.tres +++ b/config/character/monster01.tres @@ -9,7 +9,7 @@ script = ExtResource("1_4orbu") name = "monster01" type = 1 sprite_frames = ExtResource("2_su3hg") -sprite_harf_height = 26 +sprite_harf_height = 10 sprite_width = 16 move = ExtResource("1_b0lkj") hp_max = 200.0 diff --git a/config/character/monster02.tres b/config/character/monster02.tres new file mode 100644 index 0000000..b523f64 --- /dev/null +++ b/config/character/monster02.tres @@ -0,0 +1,14 @@ +[gd_resource type="Resource" script_class="CharacterCfg" load_steps=3 format=3 uid="uid://dmfh54jffhx28"] + +[ext_resource type="Script" path="res://script/config/character_cfg.gd" id="1_wkjce"] +[ext_resource type="SpriteFrames" uid="uid://criqnimi5dara" path="res://resource/animation/character/monster02_move.aseprite" id="2_h60bf"] + +[resource] +script = ExtResource("1_wkjce") +name = "monster02" +type = 0 +sprite_frames = ExtResource("2_h60bf") +sprite_harf_height = 0 +sprite_width = 0 +hp_max = 0.0 +shield_max = 0.0 diff --git a/config/player_skill/hero01_long_attack01.tres b/config/player_skill/hero01_long_attack01.tres index 4a70b8b..7a5df01 100644 --- a/config/player_skill/hero01_long_attack01.tres +++ b/config/player_skill/hero01_long_attack01.tres @@ -1,5 +1,6 @@ -[gd_resource type="Resource" script_class="PlayerSkillCfg" load_steps=5 format=3 uid="uid://b6x3jdiqtum6"] +[gd_resource type="Resource" script_class="PlayerSkillCfg" load_steps=6 format=3 uid="uid://b6x3jdiqtum6"] +[ext_resource type="Resource" uid="uid://bsqk3q6mccllg" path="res://config/attack/normal.tres" id="1_6ven2"] [ext_resource type="Script" path="res://script/config/player_skill_cfg.gd" id="1_gik08"] [ext_resource type="Animation" uid="uid://daopmieibx3b7" path="res://resource/skill_animation/hero01_long_attack01.tres" id="2_6nbpq"] [ext_resource type="SpriteFrames" uid="uid://7swf8owxd63i" path="res://resource/animation/character/hero01_long_attack.aseprite" id="3_og1bb"] @@ -14,6 +15,7 @@ break_level = 3 action = "attack_light" name = "" skill_animation = ExtResource("2_6nbpq") +attack_list = Array[Resource("res://script/config/attack_cfg.gd")]([ExtResource("1_6ven2")]) has_animation = false sprite_frams = ExtResource("3_og1bb") animation_name = "long_attack01" diff --git a/config/player_skill/hero01_long_attack02.tres b/config/player_skill/hero01_long_attack02.tres index 7020dc2..3615579 100644 --- a/config/player_skill/hero01_long_attack02.tres +++ b/config/player_skill/hero01_long_attack02.tres @@ -1,5 +1,6 @@ -[gd_resource type="Resource" script_class="PlayerSkillCfg" load_steps=5 format=3 uid="uid://cs32884hwqxd7"] +[gd_resource type="Resource" script_class="PlayerSkillCfg" load_steps=6 format=3 uid="uid://cs32884hwqxd7"] +[ext_resource type="Resource" uid="uid://bsqk3q6mccllg" path="res://config/attack/normal.tres" id="1_8fm1u"] [ext_resource type="Script" path="res://script/config/player_skill_cfg.gd" id="1_e0fqi"] [ext_resource type="Animation" uid="uid://bf6jaraltouun" path="res://resource/skill_animation/hero01_long_attack02.tres" id="2_jrgan"] [ext_resource type="SpriteFrames" uid="uid://7swf8owxd63i" path="res://resource/animation/character/hero01_long_attack.aseprite" id="3_jidy7"] @@ -14,6 +15,7 @@ break_level = 3 action = "attack_light" name = "" skill_animation = ExtResource("2_jrgan") +attack_list = Array[Resource("res://script/config/attack_cfg.gd")]([ExtResource("1_8fm1u")]) has_animation = false sprite_frams = ExtResource("3_jidy7") animation_name = "long_attack02" diff --git a/config/player_skill/hero01_long_attack03.tres b/config/player_skill/hero01_long_attack03.tres index b7254c5..9652955 100644 --- a/config/player_skill/hero01_long_attack03.tres +++ b/config/player_skill/hero01_long_attack03.tres @@ -1,5 +1,6 @@ -[gd_resource type="Resource" script_class="PlayerSkillCfg" load_steps=5 format=3 uid="uid://huxlxrmyulo"] +[gd_resource type="Resource" script_class="PlayerSkillCfg" load_steps=6 format=3 uid="uid://huxlxrmyulo"] +[ext_resource type="Resource" uid="uid://bsqk3q6mccllg" path="res://config/attack/normal.tres" id="1_4o7bo"] [ext_resource type="Script" path="res://script/config/player_skill_cfg.gd" id="1_uaib7"] [ext_resource type="Resource" uid="uid://cy3wwalxeyro0" path="res://config/weapon/long.tres" id="2_8uqiw"] [ext_resource type="Animation" uid="uid://c8yueqe7rjn60" path="res://resource/skill_animation/hero01_long_attack03.tres" id="2_ugt3f"] @@ -14,6 +15,7 @@ break_level = 3 action = "attack_light" name = "" skill_animation = ExtResource("2_ugt3f") -has_animation = true +attack_list = Array[Resource("res://script/config/attack_cfg.gd")]([ExtResource("1_4o7bo")]) +has_animation = false sprite_frams = ExtResource("3_sr2og") animation_name = "long_attack03" diff --git a/config/player_skill/hero01_long_attack04.tres b/config/player_skill/hero01_long_attack04.tres index 19e8a38..4e8e4ef 100644 --- a/config/player_skill/hero01_long_attack04.tres +++ b/config/player_skill/hero01_long_attack04.tres @@ -1,5 +1,6 @@ -[gd_resource type="Resource" script_class="PlayerSkillCfg" load_steps=5 format=3 uid="uid://chuv8k5d44ln4"] +[gd_resource type="Resource" script_class="PlayerSkillCfg" load_steps=6 format=3 uid="uid://chuv8k5d44ln4"] +[ext_resource type="Resource" uid="uid://bsqk3q6mccllg" path="res://config/attack/normal.tres" id="1_kpxla"] [ext_resource type="Script" path="res://script/config/player_skill_cfg.gd" id="1_xsxbs"] [ext_resource type="Animation" uid="uid://dk1o3gqhjmuvh" path="res://resource/skill_animation/hero01_long_attack04.tres" id="2_sam6s"] [ext_resource type="SpriteFrames" uid="uid://7swf8owxd63i" path="res://resource/animation/character/hero01_long_attack.aseprite" id="3_w7h1m"] @@ -14,6 +15,7 @@ break_level = 3 action = "attack_light" name = "" skill_animation = ExtResource("2_sam6s") -has_animation = true +attack_list = Array[Resource("res://script/config/attack_cfg.gd")]([ExtResource("1_kpxla")]) +has_animation = false sprite_frams = ExtResource("3_w7h1m") animation_name = "long_attack04" diff --git a/config/player_skill/hero01_long_flash.tres b/config/player_skill/hero01_long_flash.tres index 11535ab..6d37a86 100644 --- a/config/player_skill/hero01_long_flash.tres +++ b/config/player_skill/hero01_long_flash.tres @@ -14,6 +14,7 @@ break_level = 1 action = "flash" name = "" skill_animation = ExtResource("2_bdxlh") -has_animation = true +attack_list = Array[Resource("res://script/config/attack_cfg.gd")]([]) +has_animation = false sprite_frams = ExtResource("2_uof6p") animation_name = "long_flash" diff --git a/config/player_skill/hero01_long_skill01.tres b/config/player_skill/hero01_long_skill01.tres index 00943c9..a83fe43 100644 --- a/config/player_skill/hero01_long_skill01.tres +++ b/config/player_skill/hero01_long_skill01.tres @@ -1,5 +1,6 @@ -[gd_resource type="Resource" script_class="PlayerSkillCfg" load_steps=5 format=3 uid="uid://bi2ipbximefsr"] +[gd_resource type="Resource" script_class="PlayerSkillCfg" load_steps=6 format=3 uid="uid://bi2ipbximefsr"] +[ext_resource type="Resource" uid="uid://bsqk3q6mccllg" path="res://config/attack/normal.tres" id="1_p5wrw"] [ext_resource type="Script" path="res://script/config/player_skill_cfg.gd" id="1_ud5ph"] [ext_resource type="Animation" uid="uid://bjnkrte7660pt" path="res://resource/skill_animation/hero01_long_skill01.tres" id="2_ewts2"] [ext_resource type="SpriteFrames" uid="uid://0yuryfn6dc2v" path="res://resource/animation/character/hero01_long_skill01.aseprite" id="3_qwjfl"] @@ -14,6 +15,7 @@ break_level = 3 action = "attack_heavy" name = "" skill_animation = ExtResource("2_ewts2") -has_animation = true +attack_list = Array[Resource("res://script/config/attack_cfg.gd")]([ExtResource("1_p5wrw")]) +has_animation = false sprite_frams = ExtResource("3_qwjfl") animation_name = "long_skill01" diff --git a/resource/animation/character/monster03_attack.aseprite b/resource/animation/character/monster03_attack.aseprite index fc85942..bf18d67 100644 Binary files a/resource/animation/character/monster03_attack.aseprite and b/resource/animation/character/monster03_attack.aseprite differ diff --git a/resource/animation/character/monster03_attack.png b/resource/animation/character/monster03_attack.png index 1162d6d..1e31303 100644 Binary files a/resource/animation/character/monster03_attack.png and b/resource/animation/character/monster03_attack.png differ diff --git a/resource/skill_animation/hero01_long_attack01.tres b/resource/skill_animation/hero01_long_attack01.tres index bc7ea6b..9fa884c 100644 --- a/resource/skill_animation/hero01_long_attack01.tres +++ b/resource/skill_animation/hero01_long_attack01.tres @@ -60,7 +60,7 @@ tracks/4/path = NodePath("Status:speed_up_rate") tracks/4/interp = 1 tracks/4/loop_wrap = true tracks/4/keys = { -"times": PackedFloat32Array(0.1, 0.3), +"times": PackedFloat32Array(0.2, 0.3), "transitions": PackedFloat32Array(1, 1), "update": 1, "values": [-0.5, -1.0] @@ -77,3 +77,20 @@ tracks/5/keys = { "update": 1, "values": [1.0, 0.0] } +tracks/6/type = "method" +tracks/6/imported = false +tracks/6/enabled = true +tracks/6/path = NodePath("Battle") +tracks/6/interp = 1 +tracks/6/loop_wrap = true +tracks/6/keys = { +"times": PackedFloat32Array(0.2, 0.3), +"transitions": PackedFloat32Array(1, 1), +"values": [{ +"args": [], +"method": &"attack" +}, { +"args": [], +"method": &"attack" +}] +} diff --git a/resource/skill_animation/hero01_long_attack02.tres b/resource/skill_animation/hero01_long_attack02.tres index ab7cfa0..da9a5ef 100644 --- a/resource/skill_animation/hero01_long_attack02.tres +++ b/resource/skill_animation/hero01_long_attack02.tres @@ -60,7 +60,7 @@ tracks/4/path = NodePath("Status:speed_up_rate") tracks/4/interp = 1 tracks/4/loop_wrap = true tracks/4/keys = { -"times": PackedFloat32Array(0.1, 0.3), +"times": PackedFloat32Array(0.2, 0.3), "transitions": PackedFloat32Array(1, 1), "update": 1, "values": [-0.5, -1.0] diff --git a/resource/skill_animation/hero01_long_attack03.tres b/resource/skill_animation/hero01_long_attack03.tres index 7a13350..d7990ff 100644 --- a/resource/skill_animation/hero01_long_attack03.tres +++ b/resource/skill_animation/hero01_long_attack03.tres @@ -60,7 +60,7 @@ tracks/4/path = NodePath("Status:speed_up_rate") tracks/4/interp = 1 tracks/4/loop_wrap = true tracks/4/keys = { -"times": PackedFloat32Array(0.1, 0.3), +"times": PackedFloat32Array(0, 0.6), "transitions": PackedFloat32Array(1, 1), "update": 1, "values": [-0.5, -1.0] @@ -72,8 +72,8 @@ tracks/5/path = NodePath("Status:skill_move_speed") tracks/5/interp = 1 tracks/5/loop_wrap = true tracks/5/keys = { -"times": PackedFloat32Array(0.1, 0.3), -"transitions": PackedFloat32Array(1, 1), +"times": PackedFloat32Array(0.1, 0.3, 0.4, 0.5), +"transitions": PackedFloat32Array(1, 1, 1, 1), "update": 1, -"values": [1.0, 0.0] +"values": [1.0, 0.0, 1.0, 0.0] } diff --git a/resource/skill_animation/hero01_long_attack04.tres b/resource/skill_animation/hero01_long_attack04.tres index 9a66994..e5aa613 100644 --- a/resource/skill_animation/hero01_long_attack04.tres +++ b/resource/skill_animation/hero01_long_attack04.tres @@ -60,7 +60,7 @@ tracks/4/path = NodePath("Status:speed_up_rate") tracks/4/interp = 1 tracks/4/loop_wrap = true tracks/4/keys = { -"times": PackedFloat32Array(0.1, 0.3), +"times": PackedFloat32Array(0.1, 0.4), "transitions": PackedFloat32Array(1, 1), "update": 1, "values": [-0.5, -1.0] @@ -72,8 +72,8 @@ tracks/5/path = NodePath("Status:skill_move_speed") tracks/5/interp = 1 tracks/5/loop_wrap = true tracks/5/keys = { -"times": PackedFloat32Array(0.1, 0.3), -"transitions": PackedFloat32Array(1, 1), +"times": PackedFloat32Array(0.1, 0.5, 0.6), +"transitions": PackedFloat32Array(1, 1, 1), "update": 1, -"values": [1.0, 0.0] +"values": [0.5, 1.0, 0.0] } diff --git a/resource/skill_animation/hero01_long_flash.tres b/resource/skill_animation/hero01_long_flash.tres index 32cb32c..39cccbe 100644 --- a/resource/skill_animation/hero01_long_flash.tres +++ b/resource/skill_animation/hero01_long_flash.tres @@ -44,22 +44,34 @@ tracks/2/keys = { tracks/3/type = "value" tracks/3/imported = false tracks/3/enabled = true -tracks/3/path = NodePath("Status:speed_up_rate") +tracks/3/path = NodePath("Status:break_level") tracks/3/interp = 1 tracks/3/loop_wrap = true tracks/3/keys = { -"times": PackedFloat32Array(0.1, 0.3), -"transitions": PackedFloat32Array(1, 1), +"times": PackedFloat32Array(0, 0.2, 0.3), +"transitions": PackedFloat32Array(1, 1, 1), "update": 1, -"values": [0.0, 0.0] +"values": [0, 3, 4] } tracks/4/type = "value" tracks/4/imported = false tracks/4/enabled = true -tracks/4/path = NodePath("Status:skill_move_speed") +tracks/4/path = NodePath("Status:speed_up_rate") tracks/4/interp = 1 tracks/4/loop_wrap = true tracks/4/keys = { +"times": PackedFloat32Array(0, 0.3), +"transitions": PackedFloat32Array(1, 1), +"update": 1, +"values": [0.0, 0.0] +} +tracks/5/type = "value" +tracks/5/imported = false +tracks/5/enabled = true +tracks/5/path = NodePath("Status:skill_move_speed") +tracks/5/interp = 1 +tracks/5/loop_wrap = true +tracks/5/keys = { "times": PackedFloat32Array(0.1, 0.3), "transitions": PackedFloat32Array(1, 1), "update": 1, diff --git a/resource/skill_animation/hero01_long_skill01.tres b/resource/skill_animation/hero01_long_skill01.tres index 3163c25..cdee492 100644 --- a/resource/skill_animation/hero01_long_skill01.tres +++ b/resource/skill_animation/hero01_long_skill01.tres @@ -59,7 +59,7 @@ tracks/4/path = NodePath("Status:speed_up_rate") tracks/4/interp = 1 tracks/4/loop_wrap = true tracks/4/keys = { -"times": PackedFloat32Array(0.1, 0.3), +"times": PackedFloat32Array(0.1, 0.5), "transitions": PackedFloat32Array(1, 1), "update": 1, "values": [-0.5, -1.0] @@ -71,8 +71,8 @@ tracks/5/path = NodePath("Status:skill_move_speed") tracks/5/interp = 1 tracks/5/loop_wrap = true tracks/5/keys = { -"times": PackedFloat32Array(0.1, 0.3), +"times": PackedFloat32Array(0.1, 0.4), "transitions": PackedFloat32Array(1, 1), "update": 1, -"values": [1.0, 0.0] +"values": [4.0, 0.0] } diff --git a/scene/character/character.tscn b/scene/character/character.tscn index 667e09e..2becbb6 100644 --- a/scene/character/character.tscn +++ b/scene/character/character.tscn @@ -1,12 +1,13 @@ -[gd_scene load_steps=9 format=3 uid="uid://vnkcr04hevna"] +[gd_scene load_steps=10 format=3 uid="uid://vnkcr04hevna"] [ext_resource type="Script" path="res://script/character/character.gd" id="1_tonbs"] [ext_resource type="Script" path="res://script/character/status.gd" id="2_txdip"] -[ext_resource type="SpriteFrames" uid="uid://7swf8owxd63i" path="res://resource/animation/character/hero01_long_attack.aseprite" id="3_ibonj"] +[ext_resource type="SpriteFrames" uid="uid://7swf8owxd63i" path="res://resource/animation/character/hero01_long_attack.aseprite" id="3_safrr"] [ext_resource type="Script" path="res://script/character/move.gd" id="4_66r53"] [ext_resource type="Script" path="res://script/character/view.gd" id="4_vijjv"] [ext_resource type="Script" path="res://script/character/skill.gd" id="6_h4xqy"] [ext_resource type="AnimationLibrary" uid="uid://croik07a1qko5" path="res://resource/skill_animation_library/animation_library.tres" id="6_pakq5"] +[ext_resource type="Script" path="res://script/character/battle.gd" id="8_w84sf"] [sub_resource type="BoxShape3D" id="BoxShape3D_ty8lx"] @@ -21,13 +22,14 @@ shape = SubResource("BoxShape3D_ty8lx") [node name="Status" type="Node3D" parent="."] unique_name_in_owner = true script = ExtResource("2_txdip") +speed_up_rate = -0.5 [node name="View" type="AnimatedSprite3D" parent="."] unique_name_in_owner = true transform = Transform3D(1, 0, 0, 0, 1.414, 0, 0, 0, 1, 0, 0, 0) alpha_cut = 2 texture_filter = 0 -sprite_frames = ExtResource("3_ibonj") +sprite_frames = ExtResource("3_safrr") animation = &"long_attack01" script = ExtResource("4_vijjv") metadata/_aseprite_wizard_config_ = { @@ -51,5 +53,9 @@ libraries = { } script = ExtResource("6_h4xqy") +[node name="Battle" type="Node3D" parent="."] +unique_name_in_owner = true +script = ExtResource("8_w84sf") + [connection signal="animation_finished" from="View" to="View" method="_on_animation_finished"] [connection signal="animation_finished" from="Skill" to="Skill" method="_on_animation_finished"] diff --git a/scene/character/player.tscn b/scene/character/player.tscn index d233719..3781e03 100644 --- a/scene/character/player.tscn +++ b/scene/character/player.tscn @@ -1,19 +1,18 @@ -[gd_scene load_steps=5 format=3 uid="uid://b85fy0wfgr4gs"] +[gd_scene load_steps=4 format=3 uid="uid://uvv575nd76ji"] [ext_resource type="PackedScene" uid="uid://vnkcr04hevna" path="res://scene/character/character.tscn" id="1_bny0p"] -[ext_resource type="SpriteFrames" uid="uid://0yuryfn6dc2v" path="res://resource/animation/character/hero01_long_skill01.aseprite" id="2_cg8l2"] -[ext_resource type="Script" path="res://script/character/player/input.gd" id="2_qkra8"] -[ext_resource type="Script" path="res://script/character/player/combo.gd" id="4_jsefx"] +[ext_resource type="Script" path="res://script/character/player/combo.gd" id="2_6xb1m"] +[ext_resource type="Script" path="res://script/character/player/player_input.gd" id="2_d5j0i"] [node name="Character" instance=ExtResource("1_bny0p")] -[node name="View" parent="." index="2"] -sprite_frames = ExtResource("2_cg8l2") -animation = &"long_flash" - -[node name="Input" type="Node3D" parent="." index="5"] -script = ExtResource("2_qkra8") +[node name="Status" parent="." index="1"] +speed_up_rate = 0.0 +skill_move_speed = 4.0 [node name="Combo" type="Node3D" parent="." index="6"] unique_name_in_owner = true -script = ExtResource("4_jsefx") +script = ExtResource("2_6xb1m") + +[node name="PlayerInput" type="Node3D" parent="." index="7"] +script = ExtResource("2_d5j0i") diff --git a/scene/launcher.tscn b/scene/launcher.tscn index a6b779a..ed75637 100644 --- a/scene/launcher.tscn +++ b/scene/launcher.tscn @@ -1,8 +1,9 @@ -[gd_scene load_steps=7 format=3 uid="uid://sl6cgchsyqlo"] +[gd_scene load_steps=8 format=3 uid="uid://sl6cgchsyqlo"] [ext_resource type="Script" path="res://script/manager/game_manager.gd" id="1_q2t80"] [ext_resource type="ArrayMesh" uid="uid://cap7t5iwpjpi2" path="res://resource/level/levelground0000.vox" id="1_u51ir"] [ext_resource type="Resource" uid="uid://bjvrih37ni5nx" path="res://config/character/hero01.tres" id="2_m8pa4"] +[ext_resource type="Resource" uid="uid://b1gf2jimihmc7" path="res://config/character/monster01.tres" id="3_awqf6"] [ext_resource type="Script" path="res://script/manager/character_manager.gd" id="4_oonkb"] [ext_resource type="Script" path="res://script/editor_tool/editor_tool.gd" id="5_n3qhi"] @@ -14,6 +15,7 @@ data = PackedVector3Array(-6.4, 0, -6.4, -3.2, 0, -6.4, -3.2, 0, 6.4, -3.2, 0, 6 [node name="GameManager" type="Node3D" parent="."] script = ExtResource("1_q2t80") player = ExtResource("2_m8pa4") +test_monster = ExtResource("3_awqf6") [node name="LevelManager" type="Node3D" parent="GameManager"] unique_name_in_owner = true diff --git a/script/_global/enum.gd b/script/_global/enum.gd index be93623..1a5a85a 100644 --- a/script/_global/enum.gd +++ b/script/_global/enum.gd @@ -3,6 +3,7 @@ extends Node3D enum EActionType {Pressed, Released} enum ECharacterType {Player, Monster, Bullet} +enum ETeam {Player, Monster} enum EStance { Idle,Ground1,Ground2,Ground3,Ground4,Ground5,Ground6,Ground7, AirIdle = 10,Air1,Air2,Air3, diff --git a/script/character/battle.gd b/script/character/battle.gd new file mode 100644 index 0000000..9491c74 --- /dev/null +++ b/script/character/battle.gd @@ -0,0 +1,42 @@ +extends Node3D +class_name Battle + +@onready var character = (get_owner() as Character) +@onready var status = (%Status as Status) + +class HitInfo: + var form : int + var to : int + var dir : Vector2 + var attack : AttackCfg + +var hit_info_list = [] #命中信息 + +func attack(): + var attack_list = status.skill_cfg.attack_list + if !attack_list: + print("未配置技能攻击",status.skill_cfg) + var attack_index = status.skill_attack_index + if attack_index >= len(attack_list): + attack_index = len(attack_list) - 1 + var attack = attack_list[attack_index] + var enemy_list = character.manager().get_enemy_list(character.id()) + for enemy in enemy_list: + var pos_dir = enemy.pos()-character.pos() + var distance = pos_dir.length() + #test + if (distance < 1): + var hit_info = HitInfo.new() + hit_info.form = character.id() + hit_info.to = enemy.id() + hit_info.dir = status.skill_dir + hit_info.attack = attack + hit_info_list.append(hit_info) + +func _process(delta): + for hit_info in hit_info_list: + settle(hit_info) + hit_info_list.clear() + +func settle(hit_info:HitInfo): + print(hit_info.attack) diff --git a/script/character/character.gd b/script/character/character.gd index 985f930..c355e8d 100644 --- a/script/character/character.gd +++ b/script/character/character.gd @@ -5,8 +5,12 @@ class_name Character @onready var view = (%View as View) @onready var collision = (%Collision) -func init(id:int,cfg:CharacterCfg): +var character_manager : CharacterManager + +func init(mgr:CharacterManager,id:int,cfg:CharacterCfg,team:Enum.ETeam): + character_manager = mgr status.id = id + status.team = team status.cfg = cfg build_view(cfg) build_battle(cfg) @@ -25,3 +29,9 @@ func build_battle(cfg:CharacterCfg): status.hp_max = cfg.hp_max status.shield = cfg.shield_max status.shield_max = cfg.shield_max + +#==getter== +func manager()->CharacterManager:return character_manager +func id()->int:return status.id +func team()->Enum.ETeam:return status.team +func pos()->Vector2:return Vector2(position.x,position.z) diff --git a/script/character/player/input.gd b/script/character/player/player_input.gd similarity index 95% rename from script/character/player/input.gd rename to script/character/player/player_input.gd index c177ec7..7bac0b9 100644 --- a/script/character/player/input.gd +++ b/script/character/player/player_input.gd @@ -1,4 +1,5 @@ -extends Node +extends Node3D +class_name PlayerInput @onready var status = (%Status as Status) @onready var combo = (%Combo as Combo) diff --git a/script/character/skill.gd b/script/character/skill.gd index aadc69c..1ea8ee6 100644 --- a/script/character/skill.gd +++ b/script/character/skill.gd @@ -18,9 +18,12 @@ func cast_skill(cfg:SkillCfg,cast_dir:Vector2): if has_animation(animation_name): status.speed_up_rate = -1 status.is_free_control = false + status.is_free_turn = false status.is_skill_running = true + status.skill_cfg = cfg status.skill_dir = cast_dir status.break_level = Enum.EBreakLevel.None + if cast_dir.x != 0: status.is_right = cast_dir.x > 0 play(animation_name) else: print("技能animation不存在",animation_name) @@ -29,7 +32,9 @@ func cancel_skill(): stop() status.speed_up_rate = 0 status.is_free_control = true + status.is_free_turn = true status.is_skill_running = false + status.skill_cfg = null status.break_level = Enum.EBreakLevel.Walk view.reset() diff --git a/script/character/status.gd b/script/character/status.gd index 8fbb960..4eafaf0 100644 --- a/script/character/status.gd +++ b/script/character/status.gd @@ -2,11 +2,12 @@ extends Node3D class_name Status @export_category("实体属性") -@export var id : int -@export var owner_id : int +@export var id : int #id +@export var owner_id : int #所有者id +@export var team : Enum.ETeam #队伍 @export_category("静态属性") -@export var cfg : CharacterCfg +@export var cfg : CharacterCfg #配置表 @export_category("战斗状态") @export var hp : float #当前血量 @@ -27,9 +28,11 @@ class_name Status @export var is_jumped_check_time : float #是否已跳跃检测时间 避免未起直接判定落地 @export_category("技能状态") +@export var skill_cfg : SkillCfg #当前技能 @export var is_skill_running : bool #技能是否正在释放 @export var skill_dir : Vector2 #技能释放方向 @export var skill_move_speed : float #技能位移速度 +@export var skill_attack_index : int #技能攻击段数 @export_category("玩家技能状态") @export var input_dir : Vector2 #指令方向 diff --git a/script/config/attack_cfg.gd b/script/config/attack_cfg.gd new file mode 100644 index 0000000..6077885 --- /dev/null +++ b/script/config/attack_cfg.gd @@ -0,0 +1,17 @@ +@tool +extends Resource + +class_name AttackCfg + +#命中框信息 + +#数值信息 +@export var damage_rate : float = 1 #伤害系数 +@export var break_level : int #硬直等级 +@export var hit_back_speed : float #击退速度 +@export var hit_back_duration : float #击退持续时间 +@export var hit_up_speed : float #击飞速度 +@export var hit_up_duration : float #击飞持续时间 +@export var pause_time : float #卡帧时间 +@export var is_floating : bool #是否浮空技 + diff --git a/script/config/skill_cfg.gd b/script/config/skill_cfg.gd index f546177..83b4f74 100644 --- a/script/config/skill_cfg.gd +++ b/script/config/skill_cfg.gd @@ -5,6 +5,7 @@ class_name SkillCfg @export var name : String @export var skill_animation : Animation +@export var attack_list : Array[AttackCfg] var _has_animation : bool @export var has_animation : bool : diff --git a/script/manager/character_manager.gd b/script/manager/character_manager.gd index dbe408a..74dd366 100644 --- a/script/manager/character_manager.gd +++ b/script/manager/character_manager.gd @@ -7,7 +7,7 @@ var scene_monster = preload("res://scene/character/monster.tscn") var character_map = {} var character_idx : int = 0 -func create_character(cfg:CharacterCfg): +func create_character(cfg:CharacterCfg,team:Enum.ETeam): var characterNode:Node match cfg.type: Enum.ECharacterType.Player: @@ -19,7 +19,18 @@ func create_character(cfg:CharacterCfg): var character:Character = characterNode as Character character_idx += 1 character_map[character_idx]=character - character.init(character_idx,cfg) + character.init(self,character_idx,cfg,team) -func get_character(id:int): - return character_map[id] +func get_character(id:int) -> Character: + return character_map[id] as Character + +func get_enemy_list(id:int) -> Array[Character]: + var ret:Array[Character] = [] + var target = get_character(id) + if !target: + return ret + for key in character_map: + var character = character_map[key] as Character + if character.team() != target.team(): + ret.append(character) + return ret diff --git a/script/manager/game_manager.gd b/script/manager/game_manager.gd index c4a246e..39d3285 100644 --- a/script/manager/game_manager.gd +++ b/script/manager/game_manager.gd @@ -1,11 +1,13 @@ extends Node3D @export var player:CharacterCfg +@export var test_monster:CharacterCfg @onready var character_manager = (%CharacterManager as CharacterManager) func _ready(): - character_manager.create_character(player) + character_manager.create_character(player,Enum.ETeam.Player) + character_manager.create_character(test_monster,Enum.ETeam.Monster) func _process(delta): pass