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

@@ -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"]