Fix chinthe animations

This commit is contained in:
2025-04-10 00:04:31 -07:00
parent a7381658f4
commit 753ba60f0f
11 changed files with 405 additions and 399 deletions

View File

@@ -1,4 +1,4 @@
[gd_scene load_steps=15 format=3 uid="uid://c7wjbgbrdivol"]
[gd_scene load_steps=21 format=3 uid="uid://c7wjbgbrdivol"]
[ext_resource type="Script" uid="uid://bgaflnnur26vk" path="res://src/data_viewer/DataViewer.cs" id="1_1qako"]
[ext_resource type="Theme" uid="uid://daxuhpmyxwxck" path="res://src/inventory_menu/InventoryDialogueSelectionStyle.tres" id="2_bef6s"]
@@ -13,6 +13,12 @@
[ext_resource type="PackedScene" uid="uid://c2i8ylr3y0bri" path="res://src/enemy/enemy_types/08a. Ambassador/AmbassadorModelView.tscn" id="11_fm7p5"]
[ext_resource type="PackedScene" uid="uid://72lbcmp4bcx4" path="res://src/enemy/enemy_types/08b. Ambassador (red)/AmbassadorSmallModelView.tscn" id="12_5hrw6"]
[ext_resource type="PackedScene" uid="uid://lc5koiqn1sca" path="res://src/enemy/enemy_types/08c. Ambassador (steel)/AmbassadorSteelModelView.tscn" id="13_5hrw6"]
[ext_resource type="PackedScene" uid="uid://dxwwfbt2mtmer" path="res://src/enemy/enemy_types/11. Palan/PalanModelView.tscn" id="14_3wl4s"]
[ext_resource type="PackedScene" uid="uid://drkaq6grim1fb" path="res://src/enemy/enemy_types/12. Shield of Heaven/ShieldModelView.tscn" id="15_37gx6"]
[ext_resource type="PackedScene" uid="uid://bli0t0d6ommvi" path="res://src/enemy/enemy_types/04. sara/SaraModelView.tscn" id="16_alsxp"]
[ext_resource type="PackedScene" uid="uid://byd7cwxq1be6f" path="res://src/enemy/enemy_types/07. chinthe/ChinteModelView.tscn" id="17_qov77"]
[ext_resource type="PackedScene" uid="uid://c5xijwxkg4pf6" path="res://src/enemy/enemy_types/05. ballos/BallosModelView.tscn" id="18_sxd8s"]
[ext_resource type="PackedScene" uid="uid://c5asojy73n44d" path="res://src/enemy/enemy_types/13. gold sproingy/GoldSproingyModelView.tscn" id="19_gkucd"]
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_dvixg"]
shading_mode = 0
@@ -154,4 +160,4 @@ Press ○ to exit"
[node name="DataViewerRepository" parent="." instance=ExtResource("3_ejdn0")]
unique_name_in_owner = true
ModelRepository = Array[PackedScene]([ExtResource("5_vk1lh"), ExtResource("4_bef6s"), ExtResource("6_hpkd1"), ExtResource("8_dvixg"), ExtResource("9_utjpw"), ExtResource("10_ylptw"), ExtResource("11_fm7p5"), ExtResource("12_5hrw6"), ExtResource("13_5hrw6")])
ModelRepository = Array[PackedScene]([ExtResource("5_vk1lh"), ExtResource("4_bef6s"), ExtResource("6_hpkd1"), ExtResource("8_dvixg"), ExtResource("9_utjpw"), ExtResource("10_ylptw"), ExtResource("11_fm7p5"), ExtResource("12_5hrw6"), ExtResource("13_5hrw6"), ExtResource("14_3wl4s"), ExtResource("15_37gx6"), ExtResource("16_alsxp"), ExtResource("17_qov77"), ExtResource("18_sxd8s"), ExtResource("19_gkucd")])

View File

@@ -6952,7 +6952,7 @@ script = ExtResource("1_ol7va")
EnemyLoreInfo = SubResource("Resource_500at")
[node name="Sprite3D" type="Sprite3D" parent="."]
transform = Transform3D(-1.5, 0, -1.31134e-07, 0, 1.5, 0, 1.31134e-07, 0, -1.5, 0, 0, 0)
transform = Transform3D(-1.5, 0, -1.31134e-07, 0, 1.5, 0, 1.31134e-07, 0, -1.5, 0, 2, 0)
billboard = 2
alpha_cut = 1
texture_filter = 0

File diff suppressed because one or more lines are too long

View File

@@ -76,12 +76,7 @@ public partial class Chinthe : Enemy, IHasPrimaryAttack, ICanPatrol, ICanActivat
public void Activate()
{
if (EnemyModelView.AnimationTree.Get(PARAMETERS_PLAYBACK).As<AnimationNodeStateMachinePlayback>().GetCurrentNode().ToString().Contains("front"))
EnemyModelView.PlayActivateFrontAnimation();
if (EnemyModelView.AnimationTree.Get(PARAMETERS_PLAYBACK).As<AnimationNodeStateMachinePlayback>().GetCurrentNode().ToString().Contains("left"))
EnemyModelView.PlayActivateLeftAnimation();
if (EnemyModelView.AnimationTree.Get(PARAMETERS_PLAYBACK).As<AnimationNodeStateMachinePlayback>().GetCurrentNode().ToString().Contains("back"))
EnemyModelView.PlayActivateBackAnimation();
EnemyModelView.Activate();
}
public void Teleport()

View File

@@ -4,43 +4,91 @@ using Godot;
namespace Zennysoft.Game.Ma;
[Meta(typeof(IAutoNode))]
public partial class ChintheModelView : EnemyModelView2D
public partial class ChintheModelView : EnemyModelView2D, ICanActivate
{
private const string INACTIVE_FRONT = "inactive_front";
private const string INACTIVE_LEFT = "inactive_left";
private const string INACTIVE_BACK = "inactive_back";
private const string ACTIVATE_FRONT = "activate_front";
private const string ACTIVATE = "activate";
private const string ACTIVATE_LEFT = "activate_left";
private const string ACTIVATE_RIGHT = "activate_right";
private const string ACTIVATE_BACK = "activate_back";
public const string TELEPORT = "teleport";
private const string ACTIVATED_IDLE_FRONT = "activated_idle_front";
private const string ACTIVATED_IDLE_LEFT = "activated_idle_left";
private const string ACTIVATED_IDLE_RIGHT = "activated_idle_right";
private const string ACTIVATED_IDLE_BACK = "activated_idle_back";
private const string PRIMARY_ATTACK = "primary_attack";
private const string SECONDARY_ATTACK = "secondary_attack";
private const string PRIMARY_SKILL = "primary_skill";
private const string IDLE_FORWARD = "idle_front";
private const string IDLE_LEFT = "idle_left";
private const string IDLE_BACK = "idle_back";
private const string IDLE_FORWARD_WALK = "idle_front_walk";
private const string IDLE_LEFT_WALK = "idle_left_walk";
private const string IDLE_BACK_WALK = "idle_back_walk";
private const string PARAMETERS_PLAYBACK = "parameters/playback";
public const string TELEPORT = "teleport";
public override void _Notification(int what) => this.Notify(what);
[Export] public bool CanMove = false;
private bool _activated = false;
private bool _activating = false;
public void PlayTeleportAnimation()
{
AnimationTree.Get(PARAMETERS_PLAYBACK).As<AnimationNodeStateMachinePlayback>().Travel(TELEPORT);
}
public override void PlayIdleAnimation()
{
if (_activated)
{
switch (_currentDirection)
{
case DirectionType.FORWARD:
AnimationTree.Get(PARAMETERS_PLAYBACK).As<AnimationNodeStateMachinePlayback>().Travel(ACTIVATED_IDLE_FRONT);
break;
case DirectionType.LEFT:
AnimationTree.Get(PARAMETERS_PLAYBACK).As<AnimationNodeStateMachinePlayback>().Travel(ACTIVATED_IDLE_LEFT);
break;
case DirectionType.RIGHT:
AnimationTree.Get(PARAMETERS_PLAYBACK).As<AnimationNodeStateMachinePlayback>().Travel(ACTIVATED_IDLE_RIGHT);
break;
case DirectionType.BACKWARD:
AnimationTree.Get(PARAMETERS_PLAYBACK).As<AnimationNodeStateMachinePlayback>().Travel(ACTIVATED_IDLE_BACK);
break;
}
}
else
{
base.PlayIdleAnimation();
}
}
public void Activate()
{
_activated = true;
_activating = true;
PlayActivationAnimation();
}
private void PlayActivationAnimation()
{
switch (_currentDirection)
{
case DirectionType.FORWARD:
AnimationTree.Get(PARAMETERS_PLAYBACK).As<AnimationNodeStateMachinePlayback>().Travel(ACTIVATE);
break;
case DirectionType.LEFT:
AnimationTree.Get(PARAMETERS_PLAYBACK).As<AnimationNodeStateMachinePlayback>().Travel(ACTIVATE_LEFT);
break;
case DirectionType.RIGHT:
AnimationTree.Get(PARAMETERS_PLAYBACK).As<AnimationNodeStateMachinePlayback>().Travel(ACTIVATE_RIGHT);
break;
case DirectionType.BACKWARD:
AnimationTree.Get(PARAMETERS_PLAYBACK).As<AnimationNodeStateMachinePlayback>().Travel(ACTIVATE_BACK);
break;
}
}
public void PlayActivateFrontAnimation()
{
AnimationTree.Get(PARAMETERS_PLAYBACK).As<AnimationNodeStateMachinePlayback>().Travel(ACTIVATE_FRONT);
AnimationTree.Get(PARAMETERS_PLAYBACK).As<AnimationNodeStateMachinePlayback>().Travel(ACTIVATE);
_activated = true;
}

View File

@@ -264,8 +264,8 @@
[sub_resource type="Resource" id="Resource_f45wt"]
script = ExtResource("2_yyynn")
Name = "Agi Demon"
Description = "Lava monster"
Name = "Ambassador"
Description = "Running guy"
metadata/_custom_type_script = "uid://dlsgyx4i1jmp3"
[sub_resource type="ViewportTexture" id="ViewportTexture_h1kaf"]

View File

@@ -265,8 +265,8 @@
[sub_resource type="Resource" id="Resource_f45wt"]
script = ExtResource("2_xa3ug")
Name = "Agi Demon"
Description = "Lava monster"
Name = "Small Ambassador"
Description = "Small run guy"
metadata/_custom_type_script = "uid://dlsgyx4i1jmp3"
[sub_resource type="ViewportTexture" id="ViewportTexture_h1kaf"]

View File

@@ -265,8 +265,8 @@
[sub_resource type="Resource" id="Resource_f45wt"]
script = ExtResource("2_84ebe")
Name = "Agi Demon"
Description = "Lava monster"
Name = "Steel Ambassador"
Description = "idk"
metadata/_custom_type_script = "uid://dlsgyx4i1jmp3"
[sub_resource type="ViewportTexture" id="ViewportTexture_h1kaf"]

View File

@@ -34,7 +34,6 @@
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_qg4wx"]
resource_name = "Material.024"
cull_mode = 0
shading_mode = 0
albedo_texture = ExtResource("3_5aadh")
texture_filter = 2
@@ -76,7 +75,6 @@ shadow_mesh = SubResource("ArrayMesh_01rqy")
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_je714"]
resource_name = "Material.069"
transparency = 4
cull_mode = 0
shading_mode = 0
albedo_texture = ExtResource("4_xhe56")
@@ -117,7 +115,6 @@ shadow_mesh = SubResource("ArrayMesh_7gr4q")
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_8gncq"]
resource_name = "Material.008"
transparency = 4
cull_mode = 0
shading_mode = 0
albedo_texture = ExtResource("5_gh7is")
texture_filter = 2
@@ -206,19 +203,16 @@ shadow_mesh = SubResource("ArrayMesh_mwwpi")
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_e16rh"]
resource_name = "Material.011"
cull_mode = 0
shading_mode = 0
albedo_texture = ExtResource("6_dterl")
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_eqlbk"]
resource_name = "Material.005"
cull_mode = 0
shading_mode = 0
albedo_texture = ExtResource("7_201ll")
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_eerkc"]
resource_name = "Material.022"
cull_mode = 0
shading_mode = 0
albedo_texture = ExtResource("8_0lf1a")
@@ -227,7 +221,6 @@ resource_name = "Material.023"
transparency = 2
alpha_scissor_threshold = 0.5
alpha_antialiasing_mode = 0
cull_mode = 0
shading_mode = 0
albedo_texture = ExtResource("9_cguah")
@@ -336,7 +329,6 @@ shadow_mesh = SubResource("ArrayMesh_e6kaq")
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_fl6qo"]
resource_name = "Material.148"
transparency = 4
cull_mode = 0
shading_mode = 0
albedo_texture = ExtResource("10_w18gc")
@@ -376,13 +368,11 @@ shadow_mesh = SubResource("ArrayMesh_u45oq")
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_rt2kh"]
resource_name = "Material.037"
cull_mode = 0
shading_mode = 0
albedo_texture = ExtResource("11_6tkdt")
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_cm0rv"]
resource_name = "Material.038"
cull_mode = 0
shading_mode = 0
albedo_texture = ExtResource("12_tk8ne")
texture_filter = 2
@@ -448,7 +438,6 @@ resource_name = "Material.025"
transparency = 2
alpha_scissor_threshold = 0.5
alpha_antialiasing_mode = 0
cull_mode = 0
shading_mode = 0
albedo_texture = ExtResource("13_63cod")
@@ -457,7 +446,6 @@ resource_name = "Material.027"
transparency = 2
alpha_scissor_threshold = 0.5
alpha_antialiasing_mode = 0
cull_mode = 0
shading_mode = 0
albedo_texture = ExtResource("14_f86hx")
@@ -466,14 +454,12 @@ resource_name = "Material.028"
transparency = 2
alpha_scissor_threshold = 0.5
alpha_antialiasing_mode = 0
cull_mode = 0
shading_mode = 0
albedo_texture = ExtResource("15_585be")
texture_filter = 2
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_idwar"]
resource_name = "Material.021"
cull_mode = 0
shading_mode = 0
albedo_texture = ExtResource("16_5eiw1")
@@ -577,7 +563,6 @@ shadow_mesh = SubResource("ArrayMesh_bdas6")
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_nty38"]
resource_name = "Material.030"
cull_mode = 0
shading_mode = 0
albedo_texture = ExtResource("17_8u4ff")
texture_filter = 2
@@ -686,7 +671,6 @@ shadow_mesh = SubResource("ArrayMesh_1qr84")
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_pf4ce"]
resource_name = "Material.036"
cull_mode = 0
shading_mode = 0
albedo_texture = ExtResource("18_oehi4")
@@ -726,7 +710,6 @@ shadow_mesh = SubResource("ArrayMesh_geeum")
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_6r7n8"]
resource_name = "Material.002"
cull_mode = 0
shading_mode = 0
albedo_texture = ExtResource("19_frwwy")
texture_filter = 2
@@ -768,7 +751,6 @@ resource_name = "Material.020"
transparency = 2
alpha_scissor_threshold = 0.5
alpha_antialiasing_mode = 0
cull_mode = 0
shading_mode = 0
albedo_texture = ExtResource("20_04lke")
texture_filter = 2
@@ -807,7 +789,6 @@ shadow_mesh = SubResource("ArrayMesh_ms8aj")
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_otkmi"]
resource_name = "Material.031"
cull_mode = 0
shading_mode = 0
albedo_texture = ExtResource("21_25af7")
texture_filter = 2
@@ -846,7 +827,6 @@ shadow_mesh = SubResource("ArrayMesh_4rx5h")
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_nmgmf"]
resource_name = "Material.032"
cull_mode = 0
shading_mode = 0
albedo_texture = ExtResource("22_lqg1e")
@@ -884,7 +864,6 @@ shadow_mesh = SubResource("ArrayMesh_glbsv")
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_oj3c2"]
resource_name = "Material.033"
cull_mode = 0
shading_mode = 0
albedo_texture = ExtResource("23_3s5fx")
@@ -922,7 +901,6 @@ shadow_mesh = SubResource("ArrayMesh_1cdb8")
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_jbed4"]
resource_name = "Material.034"
cull_mode = 0
shading_mode = 0
albedo_texture = ExtResource("24_t8nkf")
@@ -963,7 +941,6 @@ resource_name = "Material.035"
transparency = 2
alpha_scissor_threshold = 0.5
alpha_antialiasing_mode = 0
cull_mode = 0
shading_mode = 0
albedo_texture = ExtResource("25_77sl0")
@@ -1074,7 +1051,6 @@ skeleton = NodePath("")
[node name="ROOM" type="MeshInstance3D" parent="Model/Seshat\'s Room/16_A1_SESHATS_ROOM"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -7.18809, 14.7067, 47.3259)
visible = false
mesh = SubResource("ArrayMesh_1wv4u")
skeleton = NodePath("")

View File

@@ -82,3 +82,15 @@ layout_mode = 2
focus_neighbor_top = NodePath("../LoadNextFloorButton")
focus_neighbor_bottom = NodePath(".")
theme_override_styles/normal = SubResource("StyleBoxFlat_1ctjd")
[node name="Label2" type="Label" parent="MarginContainer/VBoxContainer/HBoxContainer/VFlowContainer"]
layout_mode = 2
text = "Spawn Enemy:"
label_settings = ExtResource("2_a7f7f")
[node name="SpawnEnemyDropDown" type="OptionButton" parent="MarginContainer/VBoxContainer/HBoxContainer/VFlowContainer"]
unique_name_in_owner = true
layout_mode = 2
focus_neighbor_top = NodePath("../LoadNextFloorButton")
focus_neighbor_bottom = NodePath(".")
theme_override_styles/normal = SubResource("StyleBoxFlat_1ctjd")

View File

@@ -20,24 +20,41 @@ public partial class PauseDebugMenu : Control, IDebugMenu
[Node] public OptionButton SpawnItemDropDown { get; set; } = default;
private ImmutableList<InventoryItem> SpawnableItems;
[Node] public OptionButton SpawnEnemyDropDown { get; set; } = default!;
private ImmutableList<InventoryItem> _spawnableItems;
private ImmutableList<string> _spawnableEnemies;
private ItemDatabase _itemDatabase;
private string _sproingyScene = @"res://src/enemy/enemy_types/01. sproingy/Sproingy.tscn";
private string _michaelScene = @"res://src/enemy/enemy_types/02. michael/Michael.tscn";
private string _filthEaterScene = @"res://src/enemy/enemy_types/03. filth_eater/FilthEater.tscn";
public override void _Ready()
{
VisibilityChanged += PauseDebugMenu_VisibilityChanged;
LoadNextFloorButton.Pressed += LoadNextFloorButton_Pressed;
_itemDatabase = new ItemDatabase();
SpawnableItems = _itemDatabase.Items;
foreach (var item in SpawnableItems)
SpawnItemDropDown.AddItem(item.ItemName, SpawnableItems.IndexOf(item));
_spawnableItems = _itemDatabase.Items;
foreach (var item in _spawnableItems)
SpawnItemDropDown.AddItem(item.ItemName, _spawnableItems.IndexOf(item));
SpawnItemDropDown.ItemSelected += SpawnItemDropDown_ItemSelected;
_spawnableEnemies = [_sproingyScene, _michaelScene, _filthEaterScene];
SpawnEnemyDropDown.ItemSelected += SpawnEnemyDropDown_ItemSelected;
}
private void SpawnEnemyDropDown_ItemSelected(long index)
{
}
private void SpawnItemDropDown_ItemSelected(long index)
{
var itemToSpawn = SpawnableItems.ElementAt((int)index);
var itemToSpawn = _spawnableItems.ElementAt((int)index);
var duplicated = itemToSpawn.Duplicate((int)DuplicateFlags.UseInstantiation) as Node3D;
duplicated.GlobalPosition = new Vector3(_player.CurrentPosition.X, _player.CurrentPosition.Y + 1, _player.CurrentPosition.Z) + (-_player.CurrentBasis.Z * 2);
AddChild(duplicated);