Simplify enemy animation logic
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
public enum DirectionType
|
||||
{
|
||||
FORWARD,
|
||||
LEFT,
|
||||
RIGHT,
|
||||
BACKWARD
|
||||
Forward,
|
||||
Left,
|
||||
Right,
|
||||
Backward
|
||||
}
|
||||
@@ -34,58 +34,59 @@ public partial class DataViewer : Control
|
||||
|
||||
public void Initialize()
|
||||
{
|
||||
Instantiator = new Instantiator(GetTree());
|
||||
LoadModel();
|
||||
Instantiator = new Instantiator(GetTree());
|
||||
LoadModel();
|
||||
}
|
||||
|
||||
public override void _Process(double delta)
|
||||
{
|
||||
if (Input.IsActionPressed(GameInputs.MoveLeft))
|
||||
CameraPivot.RotateY(_cameraSpeed);
|
||||
if (Input.IsActionPressed(GameInputs.MoveRight))
|
||||
CameraPivot.RotateY(-_cameraSpeed);
|
||||
if (Input.IsActionPressed(GameInputs.StrafeLeft))
|
||||
Camera3D.Position = Camera3D.Position.MoveToward(CameraPivot.Position, (float)delta * 2f);
|
||||
if (Input.IsActionPressed(GameInputs.StrafeRight))
|
||||
Camera3D.Position = Camera3D.Position.MoveToward(CameraPivot.Position, -(float)delta * 2f);
|
||||
if (Input.IsActionPressed(GameInputs.MoveLeft))
|
||||
CameraPivot.RotateY(_cameraSpeed);
|
||||
if (Input.IsActionPressed(GameInputs.MoveRight))
|
||||
CameraPivot.RotateY(-_cameraSpeed);
|
||||
if (Input.IsActionPressed(GameInputs.StrafeLeft))
|
||||
Camera3D.Position = Camera3D.Position.MoveToward(CameraPivot.Position, (float)delta * 2f);
|
||||
if (Input.IsActionPressed(GameInputs.StrafeRight))
|
||||
Camera3D.Position = Camera3D.Position.MoveToward(CameraPivot.Position, -(float)delta * 2f);
|
||||
|
||||
Camera3D.Position = Camera3D.Position.Clamp(new Vector3(0, 0, 1), new Vector3(0, 0, 4));
|
||||
ModelPivot.Rotation = ModelPivot.Rotation.Clamp(Mathf.DegToRad(-60), Mathf.DegToRad(60));
|
||||
_currentModel.SetCurrentDirection(_currentModel.GlobalBasis, -CameraPivot.Basis.Z);
|
||||
_currentModel.PlayIdleAnimation();
|
||||
Camera3D.Position = Camera3D.Position.Clamp(new Vector3(0, 0, 1), new Vector3(0, 0, 4));
|
||||
ModelPivot.Rotation = ModelPivot.Rotation.Clamp(Mathf.DegToRad(-60), Mathf.DegToRad(60));
|
||||
_currentModel.SetCurrentDirection(_currentModel.GlobalBasis, -CameraPivot.Basis.Z);
|
||||
|
||||
if (Input.IsActionJustPressed(GameInputs.Attack))
|
||||
_currentModel.PlayPrimaryAttackAnimation();
|
||||
if (Input.IsActionJustPressed(GameInputs.AltAttack))
|
||||
_currentModel.PlaySecondaryAttackAnimation();
|
||||
if (Input.IsActionJustPressed(GameInputs.Inventory) && _currentModel is ICanActivate canActivate)
|
||||
canActivate.Activate();
|
||||
if (Input.IsActionPressed(GameInputs.StrafeRight))
|
||||
_currentModel.PlayWalkAnimation();
|
||||
if (Input.IsActionJustPressed(GameInputs.Attack))
|
||||
_currentModel.PlayPrimaryAttackAnimation();
|
||||
if (Input.IsActionJustPressed(GameInputs.AltAttack))
|
||||
_currentModel.PlaySecondaryAttackAnimation();
|
||||
if (Input.IsActionJustPressed(GameInputs.Inventory))
|
||||
_currentModel.PlayActivateAnimation();
|
||||
if (Input.IsActionPressed(GameInputs.StrafeRight))
|
||||
_currentModel.PlayWalkAnimation();
|
||||
if (Input.IsActionJustReleased(GameInputs.StrafeRight))
|
||||
_currentModel.PlayIdleAnimation();
|
||||
|
||||
if (Input.IsActionJustPressed(GameInputs.Next))
|
||||
{
|
||||
// Load next model
|
||||
_currentModel.CallDeferred(MethodName.QueueFree);
|
||||
_modelIndex = (_modelIndex + 1) % DataViewerRepository.ModelRepository.Count;
|
||||
GD.Print(_modelIndex);
|
||||
CallDeferred(MethodName.LoadModel);
|
||||
}
|
||||
if (Input.IsActionJustPressed(GameInputs.Previous))
|
||||
{
|
||||
// Load previous model
|
||||
_currentModel.CallDeferred(MethodName.QueueFree);
|
||||
_modelIndex = (_modelIndex - 1 < 0 ? DataViewerRepository.ModelRepository.Count : _modelIndex) - 1;
|
||||
CallDeferred(MethodName.LoadModel);
|
||||
}
|
||||
if (Input.IsActionJustPressed(GameInputs.Next))
|
||||
{
|
||||
// Load next model
|
||||
_currentModel.CallDeferred(MethodName.QueueFree);
|
||||
_modelIndex = (_modelIndex + 1) % DataViewerRepository.ModelRepository.Count;
|
||||
GD.Print(_modelIndex);
|
||||
CallDeferred(MethodName.LoadModel);
|
||||
}
|
||||
if (Input.IsActionJustPressed(GameInputs.Previous))
|
||||
{
|
||||
// Load previous model
|
||||
_currentModel.CallDeferred(MethodName.QueueFree);
|
||||
_modelIndex = (_modelIndex - 1 < 0 ? DataViewerRepository.ModelRepository.Count : _modelIndex) - 1;
|
||||
CallDeferred(MethodName.LoadModel);
|
||||
}
|
||||
}
|
||||
|
||||
private void LoadModel()
|
||||
{
|
||||
var modelScene = DataViewerRepository.ModelRepository.ElementAt(_modelIndex);
|
||||
_currentModel = modelScene.Instantiate<EnemyModelView2D>();
|
||||
ModelPivot.AddChild(_currentModel);
|
||||
EnemyName.Text = _currentModel.EnemyLoreInfo.Name;
|
||||
Description.Text = _currentModel.EnemyLoreInfo.Description;
|
||||
var modelScene = DataViewerRepository.ModelRepository.ElementAt(_modelIndex);
|
||||
_currentModel = modelScene.Instantiate<EnemyModelView2D>();
|
||||
ModelPivot.AddChild(_currentModel);
|
||||
EnemyName.Text = _currentModel.EnemyLoreInfo.Name;
|
||||
Description.Text = _currentModel.EnemyLoreInfo.Description;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -89,6 +89,16 @@ public partial class BossTypeA : CharacterBody3D, IEnemy, IHasPrimaryAttack, IHa
|
||||
Die();
|
||||
}
|
||||
|
||||
public void Idle()
|
||||
{
|
||||
_enemyModelView.PlayIdleAnimation();
|
||||
}
|
||||
|
||||
public void Move()
|
||||
{
|
||||
_enemyModelView.PlayWalkAnimation();
|
||||
}
|
||||
|
||||
public virtual void Die()
|
||||
{
|
||||
SetProcess(false);
|
||||
@@ -136,11 +146,6 @@ public partial class BossTypeA : CharacterBody3D, IEnemy, IHasPrimaryAttack, IHa
|
||||
{
|
||||
Velocity = direction * _movementSpeed;
|
||||
MoveAndSlide();
|
||||
_enemyModelView.PlayWalkAnimation();
|
||||
}
|
||||
else
|
||||
{
|
||||
_enemyModelView.PlayIdleAnimation();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ public partial class Enemy : CharacterBody3D, IEnemy, IProvide<IEnemyLogic>
|
||||
|
||||
[Node] private RayCast3D Raycast { get; set; } = default!;
|
||||
|
||||
[Node] protected IEnemyModelView _enemyModelView { get; set; } = default!;
|
||||
[Node] public IEnemyModelView EnemyModelView { get; set; } = default!;
|
||||
#endregion
|
||||
|
||||
public AutoProp<double> CurrentHP { get; set; }
|
||||
@@ -98,21 +98,13 @@ public partial class Enemy : CharacterBody3D, IEnemy, IProvide<IEnemyLogic>
|
||||
if (!lookDir.IsEqualApprox(GlobalPosition))
|
||||
LookAt(lookDir, Vector3.Up, true);
|
||||
|
||||
_enemyModelView.SetCurrentDirection(GlobalBasis, -_player.CurrentBasis.Z);
|
||||
|
||||
if (_enemyModelView is EnemyModelView2D)
|
||||
{
|
||||
if (_enemyLogic.Value is EnemyLogic.State.Patrolling or EnemyLogic.State.FollowPlayer)
|
||||
_enemyModelView.PlayWalkAnimation();
|
||||
else if (_enemyModelView is not ICanActivate)
|
||||
_enemyModelView.PlayIdleAnimation();
|
||||
}
|
||||
EnemyModelView.SetCurrentDirection(GlobalBasis, -_player.CurrentBasis.Z);
|
||||
}
|
||||
#endregion
|
||||
|
||||
public virtual void TakeAction()
|
||||
{
|
||||
_enemyModelView.PlayPrimaryAttackAnimation();
|
||||
EnemyModelView.PlayPrimaryAttackAnimation();
|
||||
}
|
||||
|
||||
public virtual void SetTarget(Vector3 target)
|
||||
@@ -145,7 +137,7 @@ public partial class Enemy : CharacterBody3D, IEnemy, IProvide<IEnemyLogic>
|
||||
if (CurrentHP.Value <= 0)
|
||||
return;
|
||||
|
||||
_enemyModelView.PlayHitAnimation();
|
||||
EnemyModelView.PlayHitAnimation();
|
||||
_enemyLogic.Input(new EnemyLogic.Input.Alerted());
|
||||
|
||||
if (this is ICanActivate activatable)
|
||||
@@ -169,7 +161,7 @@ public partial class Enemy : CharacterBody3D, IEnemy, IProvide<IEnemyLogic>
|
||||
CurrentHP.OnNext(0);
|
||||
_enemyLogic.Input(new EnemyLogic.Input.EnemyDefeated());
|
||||
_collisionShape.SetDeferred("disabled", true);
|
||||
_enemyModelView.PlayDeathAnimation();
|
||||
EnemyModelView.PlayDeathAnimation();
|
||||
var tweener = CreateTween();
|
||||
tweener.TweenInterval(1.0f);
|
||||
tweener.TweenCallback(Callable.From(QueueFree));
|
||||
@@ -196,6 +188,16 @@ public partial class Enemy : CharacterBody3D, IEnemy, IProvide<IEnemyLogic>
|
||||
_attackTimer.Timeout -= OnAttackTimeout;
|
||||
}
|
||||
|
||||
public void Idle()
|
||||
{
|
||||
EnemyModelView.PlayIdleAnimation();
|
||||
}
|
||||
|
||||
public void Move()
|
||||
{
|
||||
EnemyModelView.PlayWalkAnimation();
|
||||
}
|
||||
|
||||
public Vector3 GetEnemyGlobalPosition() => GlobalPosition;
|
||||
|
||||
public void SetEnemyGlobalPosition(Vector3 target)
|
||||
|
||||
@@ -7,24 +7,11 @@ namespace Zennysoft.Game.Ma;
|
||||
[Meta(typeof(IAutoNode))]
|
||||
public partial class EnemyModelView2D : Node3D, IEnemyModelView
|
||||
{
|
||||
protected const string PRIMARY_ATTACK = "primary_attack";
|
||||
protected const string PRIMARY_ATTACK_LEFT = "primary_attack_left";
|
||||
protected const string PRIMARY_ATTACK_RIGHT = "primary_attack_right";
|
||||
protected const string PRIMARY_ATTACK_BACK = "primary_attack_back";
|
||||
protected const string SECONDARY_ATTACK = "secondary_attack";
|
||||
protected const string SECONDARY_ATTACK_LEFT = "secondary_attack_left";
|
||||
protected const string SECONDARY_ATTACK_RIGHT = "secondary_attack_right";
|
||||
protected const string SECONDARY_ATTACK_BACK = "secondary_attack_back";
|
||||
protected const string PRIMARY_SKILL = "primary_skill";
|
||||
protected const string IDLE_FORWARD = "idle_front";
|
||||
protected const string IDLE_LEFT = "idle_left";
|
||||
protected const string IDLE_RIGHT = "idle_right";
|
||||
protected const string IDLE_BACK = "idle_back";
|
||||
protected const string IDLE_FORWARD_WALK = "idle_front_walk";
|
||||
protected const string IDLE_LEFT_WALK = "idle_left_walk";
|
||||
protected const string IDLE_RIGHT_WALK = "idle_right_walk";
|
||||
protected const string IDLE_BACK_WALK = "idle_back_walk";
|
||||
protected const string PARAMETERS_PLAYBACK = "parameters/playback";
|
||||
private readonly string _idleName = "Idle";
|
||||
private readonly string _walkingName = "Walking";
|
||||
private readonly string _primaryAttackName = "Primary Attack";
|
||||
private readonly string _secondaryAttackName = "Secondary Attack";
|
||||
private readonly string _activateName = "Activate";
|
||||
|
||||
public override void _Notification(int what) => this.Notify(what);
|
||||
|
||||
@@ -38,52 +25,30 @@ public partial class EnemyModelView2D : Node3D, IEnemyModelView
|
||||
|
||||
[Node] public AnimationTree AnimationTree { get; set; } = default!;
|
||||
|
||||
protected DirectionType _currentDirection = DirectionType.FORWARD;
|
||||
[ExportGroup("Animation Debug")]
|
||||
[Export(PropertyHint.Enum)]
|
||||
EnemyDirection _enemyDirection { get; set; } = EnemyDirection.Forward;
|
||||
|
||||
public void SetCurrentDirection(Basis enemyBasis, Vector3 cameraDirection) => _currentDirection = GetEnemyDirection(enemyBasis, cameraDirection, 0.55f, 0.45f);
|
||||
private AnimationNodeStateMachinePlayback _stateMachine;
|
||||
|
||||
public void PlayPrimaryAttackAnimation()
|
||||
public void OnReady()
|
||||
{
|
||||
switch (_currentDirection)
|
||||
{
|
||||
case DirectionType.FORWARD:
|
||||
AnimationTree.Get(PARAMETERS_PLAYBACK).As<AnimationNodeStateMachinePlayback>().Travel(PRIMARY_ATTACK);
|
||||
break;
|
||||
case DirectionType.RIGHT:
|
||||
AnimationTree.Get(PARAMETERS_PLAYBACK).As<AnimationNodeStateMachinePlayback>().Travel(PRIMARY_ATTACK_RIGHT);
|
||||
break;
|
||||
case DirectionType.LEFT:
|
||||
AnimationTree.Get(PARAMETERS_PLAYBACK).As<AnimationNodeStateMachinePlayback>().Travel(PRIMARY_ATTACK_LEFT);
|
||||
break;
|
||||
case DirectionType.BACKWARD:
|
||||
AnimationTree.Get(PARAMETERS_PLAYBACK).As<AnimationNodeStateMachinePlayback>().Travel(PRIMARY_ATTACK_BACK);
|
||||
break;
|
||||
}
|
||||
_stateMachine = (AnimationNodeStateMachinePlayback)AnimationTree.Get("parameters/playback");
|
||||
}
|
||||
|
||||
public void PlaySecondaryAttackAnimation()
|
||||
{
|
||||
switch (_currentDirection)
|
||||
{
|
||||
case DirectionType.FORWARD:
|
||||
AnimationTree.Get(PARAMETERS_PLAYBACK).As<AnimationNodeStateMachinePlayback>().Travel(SECONDARY_ATTACK);
|
||||
break;
|
||||
case DirectionType.RIGHT:
|
||||
AnimationTree.Get(PARAMETERS_PLAYBACK).As<AnimationNodeStateMachinePlayback>().Travel(SECONDARY_ATTACK_RIGHT);
|
||||
break;
|
||||
case DirectionType.LEFT:
|
||||
AnimationTree.Get(PARAMETERS_PLAYBACK).As<AnimationNodeStateMachinePlayback>().Travel(SECONDARY_ATTACK_LEFT);
|
||||
break;
|
||||
case DirectionType.BACKWARD:
|
||||
AnimationTree.Get(PARAMETERS_PLAYBACK).As<AnimationNodeStateMachinePlayback>().Travel(SECONDARY_ATTACK_BACK);
|
||||
break;
|
||||
}
|
||||
}
|
||||
public void SetCurrentDirection(Basis enemyBasis, Vector3 cameraDirection) => _enemyDirection = GetEnemyDirection(enemyBasis, cameraDirection, 0.55f, 0.45f);
|
||||
|
||||
public void PlayPrimarySkillAnimation()
|
||||
{
|
||||
AnimationTree.Get(PARAMETERS_PLAYBACK).As<AnimationNodeStateMachinePlayback>().Travel(PRIMARY_SKILL);
|
||||
}
|
||||
public void PlayPrimaryAttackAnimation() => _stateMachine.Travel(_primaryAttackName);
|
||||
|
||||
public void PlaySecondaryAttackAnimation() => _stateMachine.Travel(_secondaryAttackName);
|
||||
|
||||
public void PlayPrimarySkillAnimation() => _stateMachine.Travel("Primary Skill");
|
||||
|
||||
public void PlayIdleAnimation() => _stateMachine.Travel(_idleName);
|
||||
|
||||
public void PlayWalkAnimation() => _stateMachine.Travel(_walkingName);
|
||||
|
||||
public void PlayActivateAnimation() => _stateMachine.Travel(_activateName);
|
||||
|
||||
public void PlayHitAnimation()
|
||||
{
|
||||
@@ -100,49 +65,11 @@ public partial class EnemyModelView2D : Node3D, IEnemyModelView
|
||||
tweener.TweenCallback(Callable.From(QueueFree));
|
||||
}
|
||||
|
||||
public virtual void PlayIdleAnimation()
|
||||
{
|
||||
switch (_currentDirection)
|
||||
{
|
||||
case DirectionType.FORWARD:
|
||||
AnimationTree.Get(PARAMETERS_PLAYBACK).As<AnimationNodeStateMachinePlayback>().Travel(IDLE_FORWARD);
|
||||
break;
|
||||
case DirectionType.RIGHT:
|
||||
AnimationTree.Get(PARAMETERS_PLAYBACK).As<AnimationNodeStateMachinePlayback>().Travel(IDLE_RIGHT);
|
||||
break;
|
||||
case DirectionType.LEFT:
|
||||
AnimationTree.Get(PARAMETERS_PLAYBACK).As<AnimationNodeStateMachinePlayback>().Travel(IDLE_LEFT);
|
||||
break;
|
||||
case DirectionType.BACKWARD:
|
||||
AnimationTree.Get(PARAMETERS_PLAYBACK).As<AnimationNodeStateMachinePlayback>().Travel(IDLE_BACK);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public virtual void PlayWalkAnimation()
|
||||
{
|
||||
switch (_currentDirection)
|
||||
{
|
||||
case DirectionType.FORWARD:
|
||||
AnimationTree.Get(PARAMETERS_PLAYBACK).As<AnimationNodeStateMachinePlayback>().Travel(IDLE_FORWARD_WALK);
|
||||
break;
|
||||
case DirectionType.RIGHT:
|
||||
AnimationTree.Get(PARAMETERS_PLAYBACK).As<AnimationNodeStateMachinePlayback>().Travel(IDLE_RIGHT_WALK);
|
||||
break;
|
||||
case DirectionType.LEFT:
|
||||
AnimationTree.Get(PARAMETERS_PLAYBACK).As<AnimationNodeStateMachinePlayback>().Travel(IDLE_LEFT_WALK);
|
||||
break;
|
||||
case DirectionType.BACKWARD:
|
||||
AnimationTree.Get(PARAMETERS_PLAYBACK).As<AnimationNodeStateMachinePlayback>().Travel(IDLE_BACK_WALK);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private DirectionType GetEnemyDirection(
|
||||
Basis enemyBasis,
|
||||
Vector3 cameraDirection,
|
||||
float rotateUpperThreshold,
|
||||
float rotateLowerThreshold)
|
||||
private EnemyDirection GetEnemyDirection(
|
||||
Basis enemyBasis,
|
||||
Vector3 cameraDirection,
|
||||
float rotateUpperThreshold,
|
||||
float rotateLowerThreshold)
|
||||
{
|
||||
var enemyForwardDirection = enemyBasis.Z;
|
||||
var enemyLeftDirection = enemyBasis.X;
|
||||
@@ -150,25 +77,37 @@ public partial class EnemyModelView2D : Node3D, IEnemyModelView
|
||||
var leftDotProduct = enemyLeftDirection.Dot(cameraDirection);
|
||||
var forwardDotProduct = enemyForwardDirection.Dot(cameraDirection);
|
||||
|
||||
// Check if forward facing. If the dot product is -1, the enemy is facing the camera.
|
||||
if (forwardDotProduct < -rotateUpperThreshold)
|
||||
return DirectionType.FORWARD;
|
||||
// Check if forward facing. If the dot product is -1, the enemy is facing the camera.
|
||||
if (forwardDotProduct < -rotateUpperThreshold)
|
||||
{
|
||||
SetForward();
|
||||
return EnemyDirection.Forward;
|
||||
}
|
||||
|
||||
// Check if backward facing. If the dot product is 1, the enemy is facing the same direction as the camera.
|
||||
else if (forwardDotProduct > rotateUpperThreshold)
|
||||
return DirectionType.BACKWARD;
|
||||
else
|
||||
{
|
||||
// If the dot product of the perpendicular direction is positive (up to 1), the enemy is facing to the left (since it's mirrored).
|
||||
if (leftDotProduct > 0)
|
||||
return DirectionType.RIGHT;
|
||||
// Check if backward facing. If the dot product is 1, the enemy is facing the same direction as the camera.
|
||||
else if (forwardDotProduct > rotateUpperThreshold)
|
||||
{
|
||||
SetBack();
|
||||
return EnemyDirection.Backward;
|
||||
}
|
||||
else
|
||||
{
|
||||
// If the dot product of the perpendicular direction is positive (up to 1), the enemy is facing to the left (since it's mirrored).
|
||||
if (leftDotProduct > 0)
|
||||
{
|
||||
SetRight();
|
||||
return EnemyDirection.Right;
|
||||
}
|
||||
|
||||
// Check if side facing. If the dot product is close to zero in the positive or negative direction, its close to the threshold for turning.
|
||||
if (Mathf.Abs(forwardDotProduct) < rotateLowerThreshold)
|
||||
return DirectionType.LEFT;
|
||||
}
|
||||
// Check if side facing. If the dot product is close to zero in the positive or negative direction, its close to the threshold for turning.
|
||||
if (Mathf.Abs(forwardDotProduct) < rotateLowerThreshold)
|
||||
{
|
||||
SetLeft();
|
||||
return EnemyDirection.Left;
|
||||
}
|
||||
}
|
||||
|
||||
return _currentDirection;
|
||||
return _enemyDirection;
|
||||
}
|
||||
|
||||
private void LoadShader(string shaderPath)
|
||||
@@ -185,12 +124,39 @@ public partial class EnemyModelView2D : Node3D, IEnemyModelView
|
||||
|
||||
private void SetShaderValue(float shaderValue)
|
||||
{
|
||||
var sprites = FindChildren("*", "AnimatedSprite2D", true).Cast<AnimatedSprite2D>();
|
||||
foreach (var sprite in sprites)
|
||||
{
|
||||
var shaderMaterial = (ShaderMaterial)sprite.Material;
|
||||
shaderMaterial.SetShaderParameter("progress", shaderValue);
|
||||
}
|
||||
var sprites = FindChildren("*", "AnimatedSprite2D", true).Cast<AnimatedSprite2D>();
|
||||
foreach (var sprite in sprites)
|
||||
{
|
||||
var shaderMaterial = (ShaderMaterial)sprite.Material;
|
||||
shaderMaterial.SetShaderParameter("progress", shaderValue);
|
||||
}
|
||||
}
|
||||
|
||||
private void SetForward()
|
||||
{
|
||||
_enemyDirection = EnemyDirection.Forward;
|
||||
}
|
||||
|
||||
private void SetLeft()
|
||||
{
|
||||
_enemyDirection = EnemyDirection.Left;
|
||||
}
|
||||
|
||||
private void SetRight()
|
||||
{
|
||||
_enemyDirection = EnemyDirection.Right;
|
||||
}
|
||||
|
||||
private void SetBack()
|
||||
{
|
||||
_enemyDirection = EnemyDirection.Backward;
|
||||
}
|
||||
|
||||
private enum EnemyDirection
|
||||
{
|
||||
Left,
|
||||
Right,
|
||||
Forward,
|
||||
Backward
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,6 +62,8 @@ public partial class EnemyModelView3D : Node3D, IEnemyModelView
|
||||
AnimationTree.Get(PARAMETERS_PLAYBACK).As<AnimationNodeStateMachinePlayback>().Travel(WALK);
|
||||
}
|
||||
|
||||
public void PlayActivateAnimation() => AnimationTree.Get(PARAMETERS_PLAYBACK).As<AnimationNodeStateMachinePlayback>().Travel("Activate");
|
||||
|
||||
public void PlayIdleAnimation()
|
||||
{
|
||||
AnimationTree.Get(PARAMETERS_PLAYBACK).As<AnimationNodeStateMachinePlayback>().Travel(IDLE);
|
||||
|
||||
@@ -32,4 +32,8 @@ public interface IEnemy : IKillable
|
||||
public Vector3 GetEnemyGlobalPosition();
|
||||
|
||||
public IDungeonRoom GetCurrentRoom();
|
||||
|
||||
public void Idle();
|
||||
|
||||
public void Move();
|
||||
}
|
||||
|
||||
@@ -17,6 +17,8 @@ public interface IEnemyModelView : INode3D
|
||||
|
||||
public void PlayPrimarySkillAnimation();
|
||||
|
||||
public void PlayActivateAnimation();
|
||||
|
||||
public void PlayHitAnimation();
|
||||
|
||||
public void PlayDeathAnimation();
|
||||
|
||||
@@ -4,11 +4,7 @@ namespace Zennysoft.Game.Ma;
|
||||
|
||||
public interface INavigationAgentClient
|
||||
{
|
||||
public void CalculateVelocity(Vector3 currentPosition, bool canMove);
|
||||
public Vector3 Velocity { get; }
|
||||
|
||||
public void SetTarget(Vector3 target);
|
||||
|
||||
public bool IsAvoidanceEnabled { get; }
|
||||
|
||||
public void Stop();
|
||||
}
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
using Chickensoft.AutoInject;
|
||||
using Chickensoft.Introspection;
|
||||
using Godot;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Zennysoft.Game.Abstractions;
|
||||
|
||||
namespace Zennysoft.Game.Ma;
|
||||
|
||||
@@ -12,72 +9,49 @@ public partial class NavigationAgentClient : Node3D, INavigationAgentClient
|
||||
{
|
||||
public override void _Notification(int what) => this.Notify(what);
|
||||
|
||||
[Node] private NavigationAgent3D NavAgent { get; set; } = default!;
|
||||
[Node] private NavigationAgent3D _navAgent { get; set; } = default!;
|
||||
|
||||
[Node] private Timer _patrolTimer { get; set; } = default!;
|
||||
|
||||
private Vector3 _currentTarget = Vector3.Zero;
|
||||
private Timer _thinkTimer;
|
||||
private bool _canMove = false;
|
||||
public Vector3 Velocity { get; private set; } = Vector3.Zero;
|
||||
|
||||
private double _speedMultiplier = 2f;
|
||||
|
||||
public void Setup()
|
||||
{
|
||||
NavAgent.VelocityComputed += NavAgent_VelocityComputed;
|
||||
NavAgent.TargetReached += NavAgent_TargetReached;
|
||||
|
||||
var rng = new RandomNumberGenerator();
|
||||
rng.Randomize();
|
||||
_patrolTimer.Timeout += OnPatrolTimeout;
|
||||
_patrolTimer.WaitTime = rng.RandfRange(7.0f, 15.0f);
|
||||
|
||||
_thinkTimer = new Timer
|
||||
{
|
||||
WaitTime = 0.4f
|
||||
};
|
||||
AddChild(_thinkTimer);
|
||||
_thinkTimer.Timeout += NavAgent_TargetReached;
|
||||
_thinkTimer.Start();
|
||||
_navAgent.VelocityComputed += OnVelocityComputed;
|
||||
_navAgent.WaypointReached += _navAgent_WaypointReached;
|
||||
}
|
||||
|
||||
public void Stop()
|
||||
public override void _PhysicsProcess(double delta)
|
||||
{
|
||||
_patrolTimer.Stop();
|
||||
_thinkTimer.Stop();
|
||||
}
|
||||
|
||||
private void NavAgent_VelocityComputed(Vector3 safeVelocity)
|
||||
{
|
||||
if (!_canMove)
|
||||
if (_navAgent.IsNavigationFinished())
|
||||
return;
|
||||
|
||||
var enemy = GetOwner() as IEnemy;
|
||||
enemy.Move(safeVelocity);
|
||||
var nextPathPosition = _navAgent.GetNextPathPosition();
|
||||
var newVelocity = GlobalPosition.DirectionTo(nextPathPosition) * (float)_speedMultiplier;
|
||||
|
||||
if (_navAgent.AvoidanceEnabled)
|
||||
_navAgent.Velocity = newVelocity;
|
||||
else
|
||||
OnVelocityComputed(newVelocity);
|
||||
}
|
||||
|
||||
public void CalculateVelocity(Vector3 currentPosition, bool canMove)
|
||||
public void SetTarget(Vector3 target)
|
||||
{
|
||||
_canMove = canMove;
|
||||
var nextPathPosition = NavAgent.GetNextPathPosition();
|
||||
|
||||
var newVelocity = currentPosition.DirectionTo(nextPathPosition) * 2f;
|
||||
NavAgent.Velocity = newVelocity;
|
||||
_navAgent.TargetPosition = target;
|
||||
}
|
||||
public void SetTarget(Vector3 target) => Task.Delay(TimeSpan.FromSeconds(0.4)).ContinueWith(_ => _currentTarget = new Vector3(target.X, -1.75f, target.Z));
|
||||
|
||||
public bool IsAvoidanceEnabled => NavAgent.AvoidanceEnabled;
|
||||
|
||||
|
||||
private void NavAgent_TargetReached()
|
||||
private void OnVelocityComputed(Vector3 safeVelocity)
|
||||
{
|
||||
NavAgent.TargetPosition = _currentTarget;
|
||||
Velocity = safeVelocity;
|
||||
}
|
||||
|
||||
private void OnPatrolTimeout()
|
||||
private async void _navAgent_WaypointReached(Godot.Collections.Dictionary details)
|
||||
{
|
||||
var rng = new RandomNumberGenerator();
|
||||
rng.Randomize();
|
||||
_patrolTimer.WaitTime = rng.RandfRange(5.0f, 10.0f);
|
||||
var enemy = GetOwner() as ICanPatrol;
|
||||
enemy.Patrol();
|
||||
_speedMultiplier = 0;
|
||||
await ToSignal(GetTree().CreateTimer(2f), "timeout");
|
||||
_speedMultiplier = 2f;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -7,9 +7,6 @@ script = ExtResource("1_qwonp")
|
||||
|
||||
[node name="NavAgent" type="NavigationAgent3D" parent="."]
|
||||
unique_name_in_owner = true
|
||||
target_desired_distance = 2.0
|
||||
path_max_distance = 3.01
|
||||
avoidance_enabled = true
|
||||
radius = 1.5
|
||||
time_horizon_obstacles = 1.0
|
||||
debug_enabled = true
|
||||
|
||||
@@ -0,0 +1,118 @@
|
||||
[gd_resource type="AnimationNodeStateMachine" load_steps=25 format=3 uid="uid://dlqudph8o3py1"]
|
||||
|
||||
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_ivy74"]
|
||||
animation = &"activate_back"
|
||||
|
||||
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_x7uye"]
|
||||
animation = &"activate"
|
||||
|
||||
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_djeua"]
|
||||
animation = &"activate_left"
|
||||
|
||||
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_8wbs7"]
|
||||
animation = &"activate_right"
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_ivy74"]
|
||||
advance_mode = 2
|
||||
advance_expression = "_enemyDirection == 2"
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_x7uye"]
|
||||
switch_mode = 1
|
||||
advance_mode = 2
|
||||
advance_expression = "_enemyDirection == 0"
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_djeua"]
|
||||
switch_mode = 1
|
||||
advance_mode = 2
|
||||
advance_expression = "_enemyDirection == 2"
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_8wbs7"]
|
||||
switch_mode = 1
|
||||
advance_mode = 2
|
||||
advance_expression = "_enemyDirection == 3"
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_mnr4r"]
|
||||
switch_mode = 1
|
||||
advance_mode = 2
|
||||
advance_expression = "_enemyDirection == 2"
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_l2wq1"]
|
||||
switch_mode = 1
|
||||
advance_mode = 2
|
||||
advance_expression = "_enemyDirection == 1"
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_jwlar"]
|
||||
switch_mode = 1
|
||||
advance_mode = 2
|
||||
advance_expression = "_enemyDirection == 0"
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_fdoul"]
|
||||
switch_mode = 1
|
||||
advance_mode = 2
|
||||
advance_expression = "_enemyDirection == 0"
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_kpotx"]
|
||||
switch_mode = 1
|
||||
advance_mode = 2
|
||||
advance_expression = "_enemyDirection == 3"
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_lfuuf"]
|
||||
switch_mode = 1
|
||||
advance_mode = 2
|
||||
advance_expression = "_enemyDirection == 1"
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_dfvqa"]
|
||||
switch_mode = 1
|
||||
advance_mode = 2
|
||||
advance_expression = "_enemyDirection == 2"
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_dnvt3"]
|
||||
switch_mode = 1
|
||||
advance_mode = 2
|
||||
advance_expression = "_enemyDirection == 3"
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_m7aft"]
|
||||
switch_mode = 1
|
||||
advance_mode = 2
|
||||
advance_expression = "_enemyDirection == 1"
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_ctux2"]
|
||||
switch_mode = 2
|
||||
advance_mode = 2
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_qlkux"]
|
||||
switch_mode = 2
|
||||
advance_mode = 2
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_rmn3u"]
|
||||
switch_mode = 2
|
||||
advance_mode = 2
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_do1qe"]
|
||||
switch_mode = 2
|
||||
advance_mode = 2
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_eilyo"]
|
||||
advance_mode = 2
|
||||
advance_expression = "_enemyDirection == 0"
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_qqywc"]
|
||||
advance_mode = 2
|
||||
advance_expression = "_enemyDirection == 3"
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_p2oir"]
|
||||
advance_mode = 2
|
||||
advance_expression = "_enemyDirection == 1"
|
||||
|
||||
[resource]
|
||||
states/End/position = Vector2(997, 236)
|
||||
states/Start/position = Vector2(201, 100)
|
||||
states/back/node = SubResource("AnimationNodeAnimation_ivy74")
|
||||
states/back/position = Vector2(592, 396)
|
||||
states/forward/node = SubResource("AnimationNodeAnimation_x7uye")
|
||||
states/forward/position = Vector2(542, 68)
|
||||
states/left/node = SubResource("AnimationNodeAnimation_djeua")
|
||||
states/left/position = Vector2(378, 179)
|
||||
states/right/node = SubResource("AnimationNodeAnimation_8wbs7")
|
||||
states/right/position = Vector2(701, 179)
|
||||
transitions = ["Start", "forward", SubResource("AnimationNodeStateMachineTransition_ivy74"), "forward", "left", SubResource("AnimationNodeStateMachineTransition_x7uye"), "left", "forward", SubResource("AnimationNodeStateMachineTransition_djeua"), "forward", "back", SubResource("AnimationNodeStateMachineTransition_8wbs7"), "back", "forward", SubResource("AnimationNodeStateMachineTransition_mnr4r"), "left", "right", SubResource("AnimationNodeStateMachineTransition_l2wq1"), "right", "left", SubResource("AnimationNodeStateMachineTransition_jwlar"), "back", "left", SubResource("AnimationNodeStateMachineTransition_fdoul"), "left", "back", SubResource("AnimationNodeStateMachineTransition_kpotx"), "forward", "right", SubResource("AnimationNodeStateMachineTransition_lfuuf"), "right", "forward", SubResource("AnimationNodeStateMachineTransition_dfvqa"), "right", "back", SubResource("AnimationNodeStateMachineTransition_dnvt3"), "back", "right", SubResource("AnimationNodeStateMachineTransition_m7aft"), "forward", "End", SubResource("AnimationNodeStateMachineTransition_ctux2"), "right", "End", SubResource("AnimationNodeStateMachineTransition_qlkux"), "back", "End", SubResource("AnimationNodeStateMachineTransition_rmn3u"), "left", "End", SubResource("AnimationNodeStateMachineTransition_do1qe"), "Start", "left", SubResource("AnimationNodeStateMachineTransition_eilyo"), "Start", "back", SubResource("AnimationNodeStateMachineTransition_qqywc"), "Start", "right", SubResource("AnimationNodeStateMachineTransition_p2oir")]
|
||||
@@ -0,0 +1,88 @@
|
||||
[gd_resource type="AnimationNodeStateMachine" load_steps=18 format=3 uid="uid://bh0hsg4in5bkt"]
|
||||
|
||||
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_ivy74"]
|
||||
animation = &"activated_idle_back"
|
||||
|
||||
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_x7uye"]
|
||||
animation = &"activated_idle_front"
|
||||
|
||||
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_djeua"]
|
||||
animation = &"activated_idle_left"
|
||||
|
||||
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_8wbs7"]
|
||||
animation = &"activated_idle_right"
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_ivy74"]
|
||||
advance_mode = 2
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_x7uye"]
|
||||
switch_mode = 1
|
||||
advance_mode = 2
|
||||
advance_expression = "_enemyDirection == 0"
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_djeua"]
|
||||
switch_mode = 1
|
||||
advance_mode = 2
|
||||
advance_expression = "_enemyDirection == 2"
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_8wbs7"]
|
||||
switch_mode = 1
|
||||
advance_mode = 2
|
||||
advance_expression = "_enemyDirection == 3"
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_mnr4r"]
|
||||
switch_mode = 1
|
||||
advance_mode = 2
|
||||
advance_expression = "_enemyDirection == 2"
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_l2wq1"]
|
||||
switch_mode = 1
|
||||
advance_mode = 2
|
||||
advance_expression = "_enemyDirection == 1"
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_jwlar"]
|
||||
switch_mode = 1
|
||||
advance_mode = 2
|
||||
advance_expression = "_enemyDirection == 0"
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_fdoul"]
|
||||
switch_mode = 1
|
||||
advance_mode = 2
|
||||
advance_expression = "_enemyDirection == 0"
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_kpotx"]
|
||||
switch_mode = 1
|
||||
advance_mode = 2
|
||||
advance_expression = "_enemyDirection == 3"
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_lfuuf"]
|
||||
switch_mode = 1
|
||||
advance_mode = 2
|
||||
advance_expression = "_enemyDirection == 1"
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_dfvqa"]
|
||||
switch_mode = 1
|
||||
advance_mode = 2
|
||||
advance_expression = "_enemyDirection == 2"
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_dnvt3"]
|
||||
switch_mode = 1
|
||||
advance_mode = 2
|
||||
advance_expression = "_enemyDirection == 3"
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_m7aft"]
|
||||
switch_mode = 1
|
||||
advance_mode = 2
|
||||
advance_expression = "_enemyDirection == 1"
|
||||
|
||||
[resource]
|
||||
states/End/position = Vector2(910, 100)
|
||||
states/back/node = SubResource("AnimationNodeAnimation_ivy74")
|
||||
states/back/position = Vector2(542, 276)
|
||||
states/forward/node = SubResource("AnimationNodeAnimation_x7uye")
|
||||
states/forward/position = Vector2(542, 69)
|
||||
states/left/node = SubResource("AnimationNodeAnimation_djeua")
|
||||
states/left/position = Vector2(378, 179)
|
||||
states/right/node = SubResource("AnimationNodeAnimation_8wbs7")
|
||||
states/right/position = Vector2(701, 179)
|
||||
transitions = ["Start", "forward", SubResource("AnimationNodeStateMachineTransition_ivy74"), "forward", "left", SubResource("AnimationNodeStateMachineTransition_x7uye"), "left", "forward", SubResource("AnimationNodeStateMachineTransition_djeua"), "forward", "back", SubResource("AnimationNodeStateMachineTransition_8wbs7"), "back", "forward", SubResource("AnimationNodeStateMachineTransition_mnr4r"), "left", "right", SubResource("AnimationNodeStateMachineTransition_l2wq1"), "right", "left", SubResource("AnimationNodeStateMachineTransition_jwlar"), "back", "left", SubResource("AnimationNodeStateMachineTransition_fdoul"), "left", "back", SubResource("AnimationNodeStateMachineTransition_kpotx"), "forward", "right", SubResource("AnimationNodeStateMachineTransition_lfuuf"), "right", "forward", SubResource("AnimationNodeStateMachineTransition_dfvqa"), "right", "back", SubResource("AnimationNodeStateMachineTransition_dnvt3"), "back", "right", SubResource("AnimationNodeStateMachineTransition_m7aft")]
|
||||
@@ -0,0 +1,88 @@
|
||||
[gd_resource type="AnimationNodeStateMachine" load_steps=18 format=3 uid="uid://co7lshemjrro8"]
|
||||
|
||||
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_ivy74"]
|
||||
animation = &"idle_back"
|
||||
|
||||
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_x7uye"]
|
||||
animation = &"idle_front"
|
||||
|
||||
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_djeua"]
|
||||
animation = &"idle_left"
|
||||
|
||||
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_8wbs7"]
|
||||
animation = &"idle_right"
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_ivy74"]
|
||||
advance_mode = 2
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_x7uye"]
|
||||
switch_mode = 1
|
||||
advance_mode = 2
|
||||
advance_expression = "_enemyDirection == 0"
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_djeua"]
|
||||
switch_mode = 1
|
||||
advance_mode = 2
|
||||
advance_expression = "_enemyDirection == 2"
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_8wbs7"]
|
||||
switch_mode = 1
|
||||
advance_mode = 2
|
||||
advance_expression = "_enemyDirection == 3"
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_mnr4r"]
|
||||
switch_mode = 1
|
||||
advance_mode = 2
|
||||
advance_expression = "_enemyDirection == 2"
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_l2wq1"]
|
||||
switch_mode = 1
|
||||
advance_mode = 2
|
||||
advance_expression = "_enemyDirection == 1"
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_jwlar"]
|
||||
switch_mode = 1
|
||||
advance_mode = 2
|
||||
advance_expression = "_enemyDirection == 0"
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_fdoul"]
|
||||
switch_mode = 1
|
||||
advance_mode = 2
|
||||
advance_expression = "_enemyDirection == 0"
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_kpotx"]
|
||||
switch_mode = 1
|
||||
advance_mode = 2
|
||||
advance_expression = "_enemyDirection == 3"
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_lfuuf"]
|
||||
switch_mode = 1
|
||||
advance_mode = 2
|
||||
advance_expression = "_enemyDirection == 1"
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_dfvqa"]
|
||||
switch_mode = 1
|
||||
advance_mode = 2
|
||||
advance_expression = "_enemyDirection == 2"
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_dnvt3"]
|
||||
switch_mode = 1
|
||||
advance_mode = 2
|
||||
advance_expression = "_enemyDirection == 3"
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_m7aft"]
|
||||
switch_mode = 1
|
||||
advance_mode = 2
|
||||
advance_expression = "_enemyDirection == 1"
|
||||
|
||||
[resource]
|
||||
states/End/position = Vector2(910, 100)
|
||||
states/back/node = SubResource("AnimationNodeAnimation_ivy74")
|
||||
states/back/position = Vector2(542, 276)
|
||||
states/forward/node = SubResource("AnimationNodeAnimation_x7uye")
|
||||
states/forward/position = Vector2(542, 68)
|
||||
states/left/node = SubResource("AnimationNodeAnimation_djeua")
|
||||
states/left/position = Vector2(378, 179)
|
||||
states/right/node = SubResource("AnimationNodeAnimation_8wbs7")
|
||||
states/right/position = Vector2(701, 179)
|
||||
transitions = ["Start", "forward", SubResource("AnimationNodeStateMachineTransition_ivy74"), "forward", "left", SubResource("AnimationNodeStateMachineTransition_x7uye"), "left", "forward", SubResource("AnimationNodeStateMachineTransition_djeua"), "forward", "back", SubResource("AnimationNodeStateMachineTransition_8wbs7"), "back", "forward", SubResource("AnimationNodeStateMachineTransition_mnr4r"), "left", "right", SubResource("AnimationNodeStateMachineTransition_l2wq1"), "right", "left", SubResource("AnimationNodeStateMachineTransition_jwlar"), "back", "left", SubResource("AnimationNodeStateMachineTransition_fdoul"), "left", "back", SubResource("AnimationNodeStateMachineTransition_kpotx"), "forward", "right", SubResource("AnimationNodeStateMachineTransition_lfuuf"), "right", "forward", SubResource("AnimationNodeStateMachineTransition_dfvqa"), "right", "back", SubResource("AnimationNodeStateMachineTransition_dnvt3"), "back", "right", SubResource("AnimationNodeStateMachineTransition_m7aft")]
|
||||
@@ -0,0 +1,118 @@
|
||||
[gd_resource type="AnimationNodeStateMachine" load_steps=25 format=3 uid="uid://cbq8xog50cjjy"]
|
||||
|
||||
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_ivy74"]
|
||||
animation = &"primary_attack_back"
|
||||
|
||||
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_x7uye"]
|
||||
animation = &"primary_attack"
|
||||
|
||||
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_djeua"]
|
||||
animation = &"primary_attack_left"
|
||||
|
||||
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_8wbs7"]
|
||||
animation = &"primary_attack_right"
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_ivy74"]
|
||||
advance_mode = 2
|
||||
advance_expression = "_enemyDirection == 2"
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_x7uye"]
|
||||
switch_mode = 1
|
||||
advance_mode = 2
|
||||
advance_expression = "_enemyDirection == 0"
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_djeua"]
|
||||
switch_mode = 1
|
||||
advance_mode = 2
|
||||
advance_expression = "_enemyDirection == 2"
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_8wbs7"]
|
||||
switch_mode = 1
|
||||
advance_mode = 2
|
||||
advance_expression = "_enemyDirection == 3"
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_mnr4r"]
|
||||
switch_mode = 1
|
||||
advance_mode = 2
|
||||
advance_expression = "_enemyDirection == 2"
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_l2wq1"]
|
||||
switch_mode = 1
|
||||
advance_mode = 2
|
||||
advance_expression = "_enemyDirection == 1"
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_jwlar"]
|
||||
switch_mode = 1
|
||||
advance_mode = 2
|
||||
advance_expression = "_enemyDirection == 0"
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_fdoul"]
|
||||
switch_mode = 1
|
||||
advance_mode = 2
|
||||
advance_expression = "_enemyDirection == 0"
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_kpotx"]
|
||||
switch_mode = 1
|
||||
advance_mode = 2
|
||||
advance_expression = "_enemyDirection == 3"
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_lfuuf"]
|
||||
switch_mode = 1
|
||||
advance_mode = 2
|
||||
advance_expression = "_enemyDirection == 1"
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_dfvqa"]
|
||||
switch_mode = 1
|
||||
advance_mode = 2
|
||||
advance_expression = "_enemyDirection == 2"
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_dnvt3"]
|
||||
switch_mode = 1
|
||||
advance_mode = 2
|
||||
advance_expression = "_enemyDirection == 3"
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_m7aft"]
|
||||
switch_mode = 1
|
||||
advance_mode = 2
|
||||
advance_expression = "_enemyDirection == 1"
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_ctux2"]
|
||||
switch_mode = 2
|
||||
advance_mode = 2
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_qlkux"]
|
||||
switch_mode = 2
|
||||
advance_mode = 2
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_rmn3u"]
|
||||
switch_mode = 2
|
||||
advance_mode = 2
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_do1qe"]
|
||||
switch_mode = 2
|
||||
advance_mode = 2
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_jkh6t"]
|
||||
advance_mode = 2
|
||||
advance_expression = "_enemyDirection == 0"
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_8fa3m"]
|
||||
advance_mode = 2
|
||||
advance_expression = "_enemyDirection == 3"
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_a8clo"]
|
||||
advance_mode = 2
|
||||
advance_expression = "_enemyDirection == 1"
|
||||
|
||||
[resource]
|
||||
states/End/position = Vector2(996, 236)
|
||||
states/Start/position = Vector2(106, 236)
|
||||
states/back/node = SubResource("AnimationNodeAnimation_ivy74")
|
||||
states/back/position = Vector2(542, 276)
|
||||
states/forward/node = SubResource("AnimationNodeAnimation_x7uye")
|
||||
states/forward/position = Vector2(542, 68)
|
||||
states/left/node = SubResource("AnimationNodeAnimation_djeua")
|
||||
states/left/position = Vector2(378, 179)
|
||||
states/right/node = SubResource("AnimationNodeAnimation_8wbs7")
|
||||
states/right/position = Vector2(701, 179)
|
||||
transitions = ["Start", "forward", SubResource("AnimationNodeStateMachineTransition_ivy74"), "forward", "left", SubResource("AnimationNodeStateMachineTransition_x7uye"), "left", "forward", SubResource("AnimationNodeStateMachineTransition_djeua"), "forward", "back", SubResource("AnimationNodeStateMachineTransition_8wbs7"), "back", "forward", SubResource("AnimationNodeStateMachineTransition_mnr4r"), "left", "right", SubResource("AnimationNodeStateMachineTransition_l2wq1"), "right", "left", SubResource("AnimationNodeStateMachineTransition_jwlar"), "back", "left", SubResource("AnimationNodeStateMachineTransition_fdoul"), "left", "back", SubResource("AnimationNodeStateMachineTransition_kpotx"), "forward", "right", SubResource("AnimationNodeStateMachineTransition_lfuuf"), "right", "forward", SubResource("AnimationNodeStateMachineTransition_dfvqa"), "right", "back", SubResource("AnimationNodeStateMachineTransition_dnvt3"), "back", "right", SubResource("AnimationNodeStateMachineTransition_m7aft"), "forward", "End", SubResource("AnimationNodeStateMachineTransition_ctux2"), "right", "End", SubResource("AnimationNodeStateMachineTransition_qlkux"), "back", "End", SubResource("AnimationNodeStateMachineTransition_rmn3u"), "left", "End", SubResource("AnimationNodeStateMachineTransition_do1qe"), "Start", "left", SubResource("AnimationNodeStateMachineTransition_jkh6t"), "Start", "back", SubResource("AnimationNodeStateMachineTransition_8fa3m"), "Start", "right", SubResource("AnimationNodeStateMachineTransition_a8clo")]
|
||||
@@ -0,0 +1,118 @@
|
||||
[gd_resource type="AnimationNodeStateMachine" load_steps=25 format=3 uid="uid://clybvwx3itfeo"]
|
||||
|
||||
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_ivy74"]
|
||||
animation = &"secondary_attack_back"
|
||||
|
||||
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_x7uye"]
|
||||
animation = &"secondary_attack"
|
||||
|
||||
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_djeua"]
|
||||
animation = &"secondary_attack_left"
|
||||
|
||||
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_8wbs7"]
|
||||
animation = &"secondary_attack_right"
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_ivy74"]
|
||||
advance_mode = 2
|
||||
advance_expression = "_enemyDirection == 2"
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_x7uye"]
|
||||
switch_mode = 1
|
||||
advance_mode = 2
|
||||
advance_expression = "_enemyDirection == 0"
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_djeua"]
|
||||
switch_mode = 1
|
||||
advance_mode = 2
|
||||
advance_expression = "_enemyDirection == 2"
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_8wbs7"]
|
||||
switch_mode = 1
|
||||
advance_mode = 2
|
||||
advance_expression = "_enemyDirection == 3"
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_mnr4r"]
|
||||
switch_mode = 1
|
||||
advance_mode = 2
|
||||
advance_expression = "_enemyDirection == 2"
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_l2wq1"]
|
||||
switch_mode = 1
|
||||
advance_mode = 2
|
||||
advance_expression = "_enemyDirection == 1"
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_jwlar"]
|
||||
switch_mode = 1
|
||||
advance_mode = 2
|
||||
advance_expression = "_enemyDirection == 0"
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_fdoul"]
|
||||
switch_mode = 1
|
||||
advance_mode = 2
|
||||
advance_expression = "_enemyDirection == 0"
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_kpotx"]
|
||||
switch_mode = 1
|
||||
advance_mode = 2
|
||||
advance_expression = "_enemyDirection == 3"
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_lfuuf"]
|
||||
switch_mode = 1
|
||||
advance_mode = 2
|
||||
advance_expression = "_enemyDirection == 1"
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_dfvqa"]
|
||||
switch_mode = 1
|
||||
advance_mode = 2
|
||||
advance_expression = "_enemyDirection == 2"
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_dnvt3"]
|
||||
switch_mode = 1
|
||||
advance_mode = 2
|
||||
advance_expression = "_enemyDirection == 3"
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_m7aft"]
|
||||
switch_mode = 1
|
||||
advance_mode = 2
|
||||
advance_expression = "_enemyDirection == 1"
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_ctux2"]
|
||||
switch_mode = 2
|
||||
advance_mode = 2
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_qlkux"]
|
||||
switch_mode = 2
|
||||
advance_mode = 2
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_rmn3u"]
|
||||
switch_mode = 2
|
||||
advance_mode = 2
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_do1qe"]
|
||||
switch_mode = 2
|
||||
advance_mode = 2
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_hl6c6"]
|
||||
advance_mode = 2
|
||||
advance_expression = "_enemyDirection == 0"
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_shpbw"]
|
||||
advance_mode = 2
|
||||
advance_expression = "_enemyDirection == 1"
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_d770k"]
|
||||
advance_mode = 2
|
||||
advance_expression = "_enemyDirection == 3"
|
||||
|
||||
[resource]
|
||||
states/End/position = Vector2(996, 236)
|
||||
states/Start/position = Vector2(114, 219)
|
||||
states/back/node = SubResource("AnimationNodeAnimation_ivy74")
|
||||
states/back/position = Vector2(542, 276)
|
||||
states/forward/node = SubResource("AnimationNodeAnimation_x7uye")
|
||||
states/forward/position = Vector2(542, 68)
|
||||
states/left/node = SubResource("AnimationNodeAnimation_djeua")
|
||||
states/left/position = Vector2(378, 179)
|
||||
states/right/node = SubResource("AnimationNodeAnimation_8wbs7")
|
||||
states/right/position = Vector2(702, 179)
|
||||
transitions = ["Start", "forward", SubResource("AnimationNodeStateMachineTransition_ivy74"), "forward", "left", SubResource("AnimationNodeStateMachineTransition_x7uye"), "left", "forward", SubResource("AnimationNodeStateMachineTransition_djeua"), "forward", "back", SubResource("AnimationNodeStateMachineTransition_8wbs7"), "back", "forward", SubResource("AnimationNodeStateMachineTransition_mnr4r"), "left", "right", SubResource("AnimationNodeStateMachineTransition_l2wq1"), "right", "left", SubResource("AnimationNodeStateMachineTransition_jwlar"), "back", "left", SubResource("AnimationNodeStateMachineTransition_fdoul"), "left", "back", SubResource("AnimationNodeStateMachineTransition_kpotx"), "forward", "right", SubResource("AnimationNodeStateMachineTransition_lfuuf"), "right", "forward", SubResource("AnimationNodeStateMachineTransition_dfvqa"), "right", "back", SubResource("AnimationNodeStateMachineTransition_dnvt3"), "back", "right", SubResource("AnimationNodeStateMachineTransition_m7aft"), "forward", "End", SubResource("AnimationNodeStateMachineTransition_ctux2"), "right", "End", SubResource("AnimationNodeStateMachineTransition_qlkux"), "back", "End", SubResource("AnimationNodeStateMachineTransition_rmn3u"), "left", "End", SubResource("AnimationNodeStateMachineTransition_do1qe"), "Start", "left", SubResource("AnimationNodeStateMachineTransition_hl6c6"), "Start", "right", SubResource("AnimationNodeStateMachineTransition_shpbw"), "Start", "back", SubResource("AnimationNodeStateMachineTransition_d770k")]
|
||||
@@ -0,0 +1,88 @@
|
||||
[gd_resource type="AnimationNodeStateMachine" load_steps=18 format=3 uid="uid://cy2ngl55c0rws"]
|
||||
|
||||
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_ivy74"]
|
||||
animation = &"idle_back_walk"
|
||||
|
||||
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_x7uye"]
|
||||
animation = &"idle_front_walk"
|
||||
|
||||
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_djeua"]
|
||||
animation = &"idle_left_walk"
|
||||
|
||||
[sub_resource type="AnimationNodeAnimation" id="AnimationNodeAnimation_8wbs7"]
|
||||
animation = &"idle_right_walk"
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_ivy74"]
|
||||
advance_mode = 2
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_x7uye"]
|
||||
switch_mode = 1
|
||||
advance_mode = 2
|
||||
advance_expression = "_enemyDirection == 0"
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_djeua"]
|
||||
switch_mode = 1
|
||||
advance_mode = 2
|
||||
advance_expression = "_enemyDirection == 2"
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_8wbs7"]
|
||||
switch_mode = 1
|
||||
advance_mode = 2
|
||||
advance_expression = "_enemyDirection == 3"
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_mnr4r"]
|
||||
switch_mode = 1
|
||||
advance_mode = 2
|
||||
advance_expression = "_enemyDirection == 2"
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_l2wq1"]
|
||||
switch_mode = 1
|
||||
advance_mode = 2
|
||||
advance_expression = "_enemyDirection == 1"
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_jwlar"]
|
||||
switch_mode = 1
|
||||
advance_mode = 2
|
||||
advance_expression = "_enemyDirection == 0"
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_fdoul"]
|
||||
switch_mode = 1
|
||||
advance_mode = 2
|
||||
advance_expression = "_enemyDirection == 0"
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_kpotx"]
|
||||
switch_mode = 1
|
||||
advance_mode = 2
|
||||
advance_expression = "_enemyDirection == 3"
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_lfuuf"]
|
||||
switch_mode = 1
|
||||
advance_mode = 2
|
||||
advance_expression = "_enemyDirection == 1"
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_dfvqa"]
|
||||
switch_mode = 1
|
||||
advance_mode = 2
|
||||
advance_expression = "_enemyDirection == 2"
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_dnvt3"]
|
||||
switch_mode = 1
|
||||
advance_mode = 2
|
||||
advance_expression = "_enemyDirection == 3"
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_m7aft"]
|
||||
switch_mode = 1
|
||||
advance_mode = 2
|
||||
advance_expression = "_enemyDirection == 1"
|
||||
|
||||
[resource]
|
||||
states/End/position = Vector2(910, 100)
|
||||
states/back/node = SubResource("AnimationNodeAnimation_ivy74")
|
||||
states/back/position = Vector2(542, 276)
|
||||
states/forward/node = SubResource("AnimationNodeAnimation_x7uye")
|
||||
states/forward/position = Vector2(542, 68)
|
||||
states/left/node = SubResource("AnimationNodeAnimation_djeua")
|
||||
states/left/position = Vector2(378, 179)
|
||||
states/right/node = SubResource("AnimationNodeAnimation_8wbs7")
|
||||
states/right/position = Vector2(701, 179)
|
||||
transitions = ["Start", "forward", SubResource("AnimationNodeStateMachineTransition_ivy74"), "forward", "left", SubResource("AnimationNodeStateMachineTransition_x7uye"), "left", "forward", SubResource("AnimationNodeStateMachineTransition_djeua"), "forward", "back", SubResource("AnimationNodeStateMachineTransition_8wbs7"), "back", "forward", SubResource("AnimationNodeStateMachineTransition_mnr4r"), "left", "right", SubResource("AnimationNodeStateMachineTransition_l2wq1"), "right", "left", SubResource("AnimationNodeStateMachineTransition_jwlar"), "back", "left", SubResource("AnimationNodeStateMachineTransition_fdoul"), "left", "back", SubResource("AnimationNodeStateMachineTransition_kpotx"), "forward", "right", SubResource("AnimationNodeStateMachineTransition_lfuuf"), "right", "forward", SubResource("AnimationNodeStateMachineTransition_dfvqa"), "right", "back", SubResource("AnimationNodeStateMachineTransition_dnvt3"), "back", "right", SubResource("AnimationNodeStateMachineTransition_m7aft")]
|
||||
@@ -21,15 +21,15 @@ public partial class Sproingy : FollowsPlayerEnemy, IHasPrimaryAttack, ICanPatro
|
||||
public void OnReady()
|
||||
{
|
||||
SetPhysicsProcess(true);
|
||||
((EnemyModelView2D)_enemyModelView).Hitbox.AreaEntered += Hitbox_AreaEntered;
|
||||
((EnemyModelView2D)EnemyModelView).Hitbox.AreaEntered += Hitbox_AreaEntered;
|
||||
}
|
||||
|
||||
public void OnPhysicsProcess(double delta)
|
||||
{
|
||||
_enemyLogic.Input(new EnemyLogic.Input.PhysicsTick(delta));
|
||||
FollowPlayerAndAttack(_enemyLogic, GlobalPosition, _player.CurrentPosition);
|
||||
_navigationAgentClient.CalculateVelocity(GlobalPosition, true);
|
||||
base._PhysicsProcess(delta);
|
||||
Velocity = _navigationAgentClient.Velocity;
|
||||
MoveAndSlide();
|
||||
}
|
||||
|
||||
public override void TakeAction()
|
||||
@@ -39,13 +39,12 @@ public partial class Sproingy : FollowsPlayerEnemy, IHasPrimaryAttack, ICanPatro
|
||||
|
||||
public override void Die()
|
||||
{
|
||||
_navigationAgentClient.Stop();
|
||||
base.Die();
|
||||
}
|
||||
|
||||
public void PrimaryAttack()
|
||||
{
|
||||
_enemyModelView.PlayPrimaryAttackAnimation();
|
||||
EnemyModelView.PlayPrimaryAttackAnimation();
|
||||
}
|
||||
|
||||
public override void SetTarget(Vector3 target) => _navigationAgentClient.SetTarget(target);
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -19,20 +19,20 @@ public partial class Michael : FollowsPlayerEnemy, IHasPrimaryAttack, ICanPatrol
|
||||
public void OnReady()
|
||||
{
|
||||
SetPhysicsProcess(true);
|
||||
((EnemyModelView2D)_enemyModelView).Hitbox.AreaEntered += Hitbox_AreaEntered;
|
||||
((EnemyModelView2D)EnemyModelView).Hitbox.AreaEntered += Hitbox_AreaEntered;
|
||||
}
|
||||
|
||||
public void OnPhysicsProcess(double delta)
|
||||
{
|
||||
_enemyLogic.Input(new EnemyLogic.Input.PhysicsTick(delta));
|
||||
FollowPlayerAndAttack(_enemyLogic, GlobalPosition, _player.CurrentPosition);
|
||||
_navigationAgentClient.CalculateVelocity(GlobalPosition, true);
|
||||
Velocity = _navigationAgentClient.Velocity;
|
||||
base._PhysicsProcess(delta);
|
||||
}
|
||||
|
||||
public override void Die()
|
||||
{
|
||||
_navigationAgentClient.Stop();
|
||||
//_navigationAgentClient.Stop();
|
||||
base.Die();
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ public partial class Michael : FollowsPlayerEnemy, IHasPrimaryAttack, ICanPatrol
|
||||
|
||||
public void PrimaryAttack()
|
||||
{
|
||||
_enemyModelView.PlayPrimaryAttackAnimation();
|
||||
EnemyModelView.PlayPrimaryAttackAnimation();
|
||||
}
|
||||
|
||||
public override void SetTarget(Vector3 target) => _navigationAgentClient.SetTarget(target);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
[gd_scene load_steps=140 format=3 uid="uid://bjg8wyvp8q6oc"]
|
||||
[gd_scene load_steps=142 format=3 uid="uid://bjg8wyvp8q6oc"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://cvr1qimxpignl" path="res://src/enemy/EnemyModelView2D.cs" id="1_o4cc2"]
|
||||
[ext_resource type="Script" uid="uid://dlsgyx4i1jmp3" path="res://src/enemy/EnemyLoreInfo.cs" id="2_3eot4"]
|
||||
@@ -73,7 +73,9 @@
|
||||
[ext_resource type="Texture2D" uid="uid://djspx2smexhme" path="res://src/enemy/enemy_types/02. michael/animations/IDLE_WALK/LEFT SIDE/Michael_IdleWalk_Left (23).png" id="70_f0jo7"]
|
||||
[ext_resource type="Script" uid="uid://6edayafleq8y" path="res://src/hitbox/Hitbox.cs" id="71_ul4dn"]
|
||||
[ext_resource type="PackedScene" uid="uid://dpoonda2dwwic" path="res://src/enemy/BasicEnemyAnimationTree.tscn" id="73_gby04"]
|
||||
[ext_resource type="AnimationNodeStateMachine" uid="uid://cbq8xog50cjjy" path="res://src/enemy/animation_state_machines/PrimaryAttackStateMachine.tres" id="74_fxhv6"]
|
||||
[ext_resource type="Texture2D" uid="uid://duygq1qfer5oa" path="res://src/vfx/Enemy/michael_attack.png" id="74_mip6u"]
|
||||
[ext_resource type="AnimationNodeStateMachine" uid="uid://co7lshemjrro8" path="res://src/enemy/animation_state_machines/IdleStateMachine.tres" id="74_pxi1p"]
|
||||
|
||||
[sub_resource type="Resource" id="Resource_gby04"]
|
||||
script = ExtResource("2_3eot4")
|
||||
@@ -376,40 +378,22 @@ tracks/4/keys = {
|
||||
"update": 1,
|
||||
"values": [41]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_3g180"]
|
||||
resource_name = "idle_back"
|
||||
length = 1.91667
|
||||
loop_mode = 1
|
||||
step = 0.0833333
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("Sprite3D/SubViewportContainer/SubViewport/AnimatedSprite:frame")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0, 1.83333),
|
||||
"transitions": PackedFloat32Array(1, 1),
|
||||
"update": 0,
|
||||
"values": [0, 22]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath("Sprite3D/SubViewportContainer/SubViewport/AnimatedSprite:animation")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
tracks/5/type = "value"
|
||||
tracks/5/imported = false
|
||||
tracks/5/enabled = true
|
||||
tracks/5/path = NodePath("Sprite3D:flip_h")
|
||||
tracks/5/interp = 1
|
||||
tracks/5/loop_wrap = true
|
||||
tracks/5/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 1,
|
||||
"values": [&"idle_back_walk"]
|
||||
"values": [false]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_ppbeh"]
|
||||
resource_name = "idle_back_walk"
|
||||
length = 1.91667
|
||||
[sub_resource type="Animation" id="Animation_3g180"]
|
||||
resource_name = "idle_back"
|
||||
length = 1.83334
|
||||
loop_mode = 1
|
||||
step = 0.0833333
|
||||
tracks/0/type = "value"
|
||||
@@ -417,7 +401,7 @@ tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("Sprite3D/SubViewportContainer/SubViewport/AnimatedSprite:frame")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/loop_wrap = false
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0, 1.83333),
|
||||
"transitions": PackedFloat32Array(1, 1),
|
||||
@@ -439,7 +423,7 @@ tracks/1/keys = {
|
||||
|
||||
[sub_resource type="Animation" id="Animation_fssmb"]
|
||||
resource_name = "idle_front"
|
||||
length = 1.91667
|
||||
length = 1.83334
|
||||
loop_mode = 1
|
||||
step = 0.0833333
|
||||
tracks/0/type = "value"
|
||||
@@ -447,67 +431,7 @@ tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("Sprite3D/SubViewportContainer/SubViewport/AnimatedSprite:frame")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0, 1.8333),
|
||||
"transitions": PackedFloat32Array(1, 1),
|
||||
"update": 0,
|
||||
"values": [0, 22]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath("Sprite3D/SubViewportContainer/SubViewport/AnimatedSprite:animation")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 1,
|
||||
"values": [&"idle_front_walk"]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_3dffb"]
|
||||
resource_name = "idle_front_walk"
|
||||
length = 1.91667
|
||||
loop_mode = 1
|
||||
step = 0.0833333
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("Sprite3D/SubViewportContainer/SubViewport/AnimatedSprite:frame")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0, 1.8333),
|
||||
"transitions": PackedFloat32Array(1, 1),
|
||||
"update": 0,
|
||||
"values": [0, 22]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath("Sprite3D/SubViewportContainer/SubViewport/AnimatedSprite:animation")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 1,
|
||||
"values": [&"idle_front_walk"]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_oy7vk"]
|
||||
resource_name = "idle_left"
|
||||
length = 1.91667
|
||||
loop_mode = 1
|
||||
step = 0.0833333
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("Sprite3D/SubViewportContainer/SubViewport/AnimatedSprite:frame")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/loop_wrap = false
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0, 1.83333),
|
||||
"transitions": PackedFloat32Array(1, 1),
|
||||
@@ -519,17 +443,17 @@ tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath("Sprite3D/SubViewportContainer/SubViewport/AnimatedSprite:animation")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/loop_wrap = false
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 1,
|
||||
"values": [&"idle_left_walk"]
|
||||
"values": [&"idle_front_walk"]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_0qxqf"]
|
||||
resource_name = "idle_left_walk"
|
||||
length = 1.91667
|
||||
[sub_resource type="Animation" id="Animation_oy7vk"]
|
||||
resource_name = "idle_left"
|
||||
length = 1.83334
|
||||
loop_mode = 1
|
||||
step = 0.0833333
|
||||
tracks/0/type = "value"
|
||||
@@ -537,7 +461,7 @@ tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("Sprite3D/SubViewportContainer/SubViewport/AnimatedSprite:frame")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/loop_wrap = false
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0, 1.83333),
|
||||
"transitions": PackedFloat32Array(1, 1),
|
||||
@@ -559,7 +483,7 @@ tracks/1/keys = {
|
||||
|
||||
[sub_resource type="Animation" id="Animation_tbydq"]
|
||||
resource_name = "idle_right"
|
||||
length = 1.91667
|
||||
length = 1.83334
|
||||
loop_mode = 1
|
||||
step = 0.0833333
|
||||
tracks/0/type = "value"
|
||||
@@ -567,7 +491,7 @@ tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("Sprite3D/SubViewportContainer/SubViewport/AnimatedSprite:frame")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/loop_wrap = false
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0, 1.83333),
|
||||
"transitions": PackedFloat32Array(1, 1),
|
||||
@@ -586,35 +510,17 @@ tracks/1/keys = {
|
||||
"update": 1,
|
||||
"values": [&"idle_left_walk"]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_3eot4"]
|
||||
resource_name = "idle_right_walk"
|
||||
length = 1.91667
|
||||
loop_mode = 1
|
||||
step = 0.0833333
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("Sprite3D/SubViewportContainer/SubViewport/AnimatedSprite:frame")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
tracks/2/type = "value"
|
||||
tracks/2/imported = false
|
||||
tracks/2/enabled = true
|
||||
tracks/2/path = NodePath("Sprite3D:flip_h")
|
||||
tracks/2/interp = 1
|
||||
tracks/2/loop_wrap = true
|
||||
tracks/2/keys = {
|
||||
"times": PackedFloat32Array(0, 1.83333),
|
||||
"transitions": PackedFloat32Array(1, 1),
|
||||
"update": 0,
|
||||
"values": [0, 22]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath("Sprite3D/SubViewportContainer/SubViewport/AnimatedSprite:animation")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 1,
|
||||
"values": [&"idle_left_walk"]
|
||||
"values": [true, false]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_0k3e8"]
|
||||
@@ -694,7 +600,7 @@ tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 1,
|
||||
"values": [&"idle_front_walk"]
|
||||
"values": [&"idle_back_walk"]
|
||||
}
|
||||
tracks/2/type = "value"
|
||||
tracks/2/imported = false
|
||||
@@ -759,7 +665,7 @@ tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 1,
|
||||
"values": [&"idle_front_walk"]
|
||||
"values": [&"idle_left_walk"]
|
||||
}
|
||||
tracks/2/type = "value"
|
||||
tracks/2/imported = false
|
||||
@@ -824,7 +730,7 @@ tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 1,
|
||||
"values": [&"idle_front_walk"]
|
||||
"values": [&"idle_left_walk"]
|
||||
}
|
||||
tracks/2/type = "value"
|
||||
tracks/2/imported = false
|
||||
@@ -862,24 +768,48 @@ tracks/4/keys = {
|
||||
"update": 0,
|
||||
"values": [0, 41]
|
||||
}
|
||||
tracks/5/type = "value"
|
||||
tracks/5/imported = false
|
||||
tracks/5/enabled = true
|
||||
tracks/5/path = NodePath("Sprite3D:flip_h")
|
||||
tracks/5/interp = 1
|
||||
tracks/5/loop_wrap = true
|
||||
tracks/5/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 1,
|
||||
"values": [true]
|
||||
}
|
||||
|
||||
[sub_resource type="AnimationLibrary" id="AnimationLibrary_346xs"]
|
||||
_data = {
|
||||
&"RESET": SubResource("Animation_41ppy"),
|
||||
&"idle_back": SubResource("Animation_3g180"),
|
||||
&"idle_back_walk": SubResource("Animation_ppbeh"),
|
||||
&"idle_front": SubResource("Animation_fssmb"),
|
||||
&"idle_front_walk": SubResource("Animation_3dffb"),
|
||||
&"idle_left": SubResource("Animation_oy7vk"),
|
||||
&"idle_left_walk": SubResource("Animation_0qxqf"),
|
||||
&"idle_right": SubResource("Animation_tbydq"),
|
||||
&"idle_right_walk": SubResource("Animation_3eot4"),
|
||||
&"primary_attack": SubResource("Animation_0k3e8"),
|
||||
&"primary_attack_back": SubResource("Animation_bk4gf"),
|
||||
&"primary_attack_left": SubResource("Animation_gby04"),
|
||||
&"primary_attack_right": SubResource("Animation_mip6u")
|
||||
}
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_d8ow6"]
|
||||
advance_mode = 2
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_ck0ak"]
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_y4gx8"]
|
||||
switch_mode = 2
|
||||
advance_mode = 2
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachine" id="AnimationNodeStateMachine_gejfr"]
|
||||
states/Idle/node = ExtResource("74_pxi1p")
|
||||
states/Idle/position = Vector2(417, 93)
|
||||
"states/Primary Attack/node" = ExtResource("74_fxhv6")
|
||||
"states/Primary Attack/position" = Vector2(428, 248)
|
||||
transitions = ["Start", "Idle", SubResource("AnimationNodeStateMachineTransition_d8ow6"), "Idle", "Primary Attack", SubResource("AnimationNodeStateMachineTransition_ck0ak"), "Primary Attack", "Idle", SubResource("AnimationNodeStateMachineTransition_y4gx8")]
|
||||
|
||||
[sub_resource type="Animation" id="Animation_fxhv6"]
|
||||
resource_name = "Attack VFX"
|
||||
length = 1.4
|
||||
@@ -1246,6 +1176,7 @@ animations = [{
|
||||
[node name="EnemyModelView" type="Node3D"]
|
||||
script = ExtResource("1_o4cc2")
|
||||
EnemyLoreInfo = SubResource("Resource_gby04")
|
||||
_enemyDirection = 1
|
||||
|
||||
[node name="Sprite3D" type="Sprite3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -0.086869, 0)
|
||||
@@ -1298,6 +1229,8 @@ libraries = {
|
||||
|
||||
[node name="AnimationTree" parent="." instance=ExtResource("73_gby04")]
|
||||
unique_name_in_owner = true
|
||||
tree_root = SubResource("AnimationNodeStateMachine_gejfr")
|
||||
advance_expression_base_node = NodePath("..")
|
||||
|
||||
[node name="VFX Animation Player" type="AnimationPlayer" parent="."]
|
||||
root_node = NodePath("../AnimationPlayer")
|
||||
|
||||
@@ -26,14 +26,14 @@ public partial class FilthEater : FollowsPlayerEnemy, IHasPrimaryAttack, IHasSec
|
||||
public void OnReady()
|
||||
{
|
||||
SetPhysicsProcess(true);
|
||||
((EnemyModelView2D)_enemyModelView).Hitbox.AreaEntered += Hitbox_AreaEntered;
|
||||
((EnemyModelView2D)EnemyModelView).Hitbox.AreaEntered += Hitbox_AreaEntered;
|
||||
}
|
||||
|
||||
public void OnPhysicsProcess(double delta)
|
||||
{
|
||||
_enemyLogic.Input(new EnemyLogic.Input.PhysicsTick(delta));
|
||||
FollowPlayerAndAttack(_enemyLogic, GlobalPosition, _player.CurrentPosition);
|
||||
_navigationAgentClient.CalculateVelocity(GlobalPosition, true);
|
||||
Velocity = _navigationAgentClient.Velocity;
|
||||
base._PhysicsProcess(delta);
|
||||
}
|
||||
|
||||
@@ -46,17 +46,17 @@ public partial class FilthEater : FollowsPlayerEnemy, IHasPrimaryAttack, IHasSec
|
||||
}
|
||||
public void PrimaryAttack()
|
||||
{
|
||||
_enemyModelView.PlayPrimaryAttackAnimation();
|
||||
EnemyModelView.PlayPrimaryAttackAnimation();
|
||||
}
|
||||
|
||||
public void SecondaryAttack()
|
||||
{
|
||||
_enemyModelView.PlaySecondaryAttackAnimation();
|
||||
EnemyModelView.PlaySecondaryAttackAnimation();
|
||||
}
|
||||
|
||||
public void RangedAttack()
|
||||
{
|
||||
_enemyModelView.PlaySecondaryAttackAnimation();
|
||||
EnemyModelView.PlaySecondaryAttackAnimation();
|
||||
}
|
||||
|
||||
public void Patrol()
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
[gd_scene load_steps=289 format=3 uid="uid://bup8c4x1na3aw"]
|
||||
[gd_scene load_steps=303 format=3 uid="uid://bup8c4x1na3aw"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://cvr1qimxpignl" path="res://src/enemy/EnemyModelView2D.cs" id="1_718m1"]
|
||||
[ext_resource type="Script" uid="uid://dlsgyx4i1jmp3" path="res://src/enemy/EnemyLoreInfo.cs" id="2_krqul"]
|
||||
@@ -194,6 +194,10 @@
|
||||
[ext_resource type="Texture2D" uid="uid://bxijhjyqvfrip" path="res://src/enemy/enemy_types/03. filth_eater/animations/Filth Side Attacks Frames/ATTACK 2 SIDE/frame_073_delay-0.01s.png" id="190_wg32o"]
|
||||
[ext_resource type="PackedScene" uid="uid://diaxvpmwgl65u" path="res://src/enemy/TwoAttacksEnemyAnimationTree.tscn" id="193_krqul"]
|
||||
[ext_resource type="Texture2D" uid="uid://d0q5jru1am4v0" path="res://src/vfx/Enemy/FILTH_BLAST.png" id="194_pyy2h"]
|
||||
[ext_resource type="AnimationNodeStateMachine" uid="uid://co7lshemjrro8" path="res://src/enemy/animation_state_machines/IdleStateMachine.tres" id="194_u5xjp"]
|
||||
[ext_resource type="AnimationNodeStateMachine" uid="uid://cbq8xog50cjjy" path="res://src/enemy/animation_state_machines/PrimaryAttackStateMachine.tres" id="195_5cwnl"]
|
||||
[ext_resource type="AnimationNodeStateMachine" uid="uid://clybvwx3itfeo" path="res://src/enemy/animation_state_machines/SecondaryAttackStateMachine.tres" id="196_e0gee"]
|
||||
[ext_resource type="AnimationNodeStateMachine" uid="uid://cy2ngl55c0rws" path="res://src/enemy/animation_state_machines/WalkingStateMachine.tres" id="197_mno7m"]
|
||||
|
||||
[sub_resource type="Resource" id="Resource_pyy2h"]
|
||||
script = ExtResource("2_krqul")
|
||||
@@ -1782,6 +1786,40 @@ _data = {
|
||||
&"secondary_attack_right": SubResource("Animation_smxxh")
|
||||
}
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_u5xjp"]
|
||||
advance_mode = 2
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_5cwnl"]
|
||||
switch_mode = 2
|
||||
advance_mode = 2
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_e0gee"]
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_mno7m"]
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_4h5gj"]
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_e5pq0"]
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_wka7s"]
|
||||
switch_mode = 2
|
||||
advance_mode = 2
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_8jscc"]
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_7vrs0"]
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachine" id="AnimationNodeStateMachine_e5pq0"]
|
||||
states/Idle/node = ExtResource("194_u5xjp")
|
||||
states/Idle/position = Vector2(373, 100)
|
||||
"states/Primary Attack/node" = ExtResource("195_5cwnl")
|
||||
"states/Primary Attack/position" = Vector2(373, 218)
|
||||
"states/Secondary Attack/node" = ExtResource("196_e0gee")
|
||||
"states/Secondary Attack/position" = Vector2(588, 218)
|
||||
states/Walking/node = ExtResource("197_mno7m")
|
||||
states/Walking/position = Vector2(588, 100)
|
||||
transitions = ["Start", "Idle", SubResource("AnimationNodeStateMachineTransition_u5xjp"), "Primary Attack", "Idle", SubResource("AnimationNodeStateMachineTransition_5cwnl"), "Idle", "Primary Attack", SubResource("AnimationNodeStateMachineTransition_e0gee"), "Idle", "Walking", SubResource("AnimationNodeStateMachineTransition_mno7m"), "Walking", "Idle", SubResource("AnimationNodeStateMachineTransition_4h5gj"), "Idle", "Secondary Attack", SubResource("AnimationNodeStateMachineTransition_e5pq0"), "Secondary Attack", "Idle", SubResource("AnimationNodeStateMachineTransition_wka7s"), "Walking", "Secondary Attack", SubResource("AnimationNodeStateMachineTransition_8jscc"), "Walking", "Primary Attack", SubResource("AnimationNodeStateMachineTransition_7vrs0")]
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_smxxh"]
|
||||
atlas = ExtResource("194_pyy2h")
|
||||
region = Rect2(0, 0, 200, 200)
|
||||
@@ -2307,6 +2345,7 @@ _data = {
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.97683, 0)
|
||||
script = ExtResource("1_718m1")
|
||||
EnemyLoreInfo = SubResource("Resource_pyy2h")
|
||||
_enemyDirection = 1
|
||||
|
||||
[node name="Sprite3D" type="Sprite3D" parent="."]
|
||||
transform = Transform3D(1.5, 0, 0, 0, 1.5, 0, 0, 0, 1.5, 0, 0.0862446, 0)
|
||||
@@ -2356,6 +2395,8 @@ libraries = {
|
||||
|
||||
[node name="AnimationTree" parent="." instance=ExtResource("193_krqul")]
|
||||
unique_name_in_owner = true
|
||||
tree_root = SubResource("AnimationNodeStateMachine_e5pq0")
|
||||
advance_expression_base_node = NodePath("..")
|
||||
|
||||
[node name="attack VFX" type="AnimatedSprite3D" parent="."]
|
||||
transform = Transform3D(1.5, 0, 0, 0, 1.5, 0, 0, 0, 1.5, -0.0228448, 0.423145, 0)
|
||||
|
||||
@@ -27,14 +27,14 @@ public partial class Sara : FollowsPlayerEnemy, IHasPrimaryAttack, IHasSecondary
|
||||
public void OnReady()
|
||||
{
|
||||
SetPhysicsProcess(true);
|
||||
((EnemyModelView2D)_enemyModelView).Hitbox.AreaEntered += Hitbox_AreaEntered;
|
||||
((EnemyModelView2D)EnemyModelView).Hitbox.AreaEntered += Hitbox_AreaEntered;
|
||||
}
|
||||
|
||||
public void OnPhysicsProcess(double delta)
|
||||
{
|
||||
_enemyLogic.Input(new EnemyLogic.Input.PhysicsTick(delta));
|
||||
FollowPlayerAndAttack(_enemyLogic, GlobalPosition, _player.CurrentPosition);
|
||||
_navigationAgentClient.CalculateVelocity(GlobalPosition, true);
|
||||
Velocity = _navigationAgentClient.Velocity;
|
||||
base._PhysicsProcess(delta);
|
||||
}
|
||||
|
||||
@@ -48,18 +48,17 @@ public partial class Sara : FollowsPlayerEnemy, IHasPrimaryAttack, IHasSecondary
|
||||
|
||||
public override void Die()
|
||||
{
|
||||
_navigationAgentClient.Stop();
|
||||
base.Die();
|
||||
}
|
||||
|
||||
public void PrimaryAttack()
|
||||
{
|
||||
_enemyModelView.PlayPrimaryAttackAnimation();
|
||||
EnemyModelView.PlayPrimaryAttackAnimation();
|
||||
}
|
||||
|
||||
public void SecondaryAttack()
|
||||
{
|
||||
_enemyModelView.PlaySecondaryAttackAnimation();
|
||||
EnemyModelView.PlaySecondaryAttackAnimation();
|
||||
}
|
||||
|
||||
public override void SetTarget(Vector3 target) => _navigationAgentClient.SetTarget(target);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
[gd_scene load_steps=221 format=3 uid="uid://bli0t0d6ommvi"]
|
||||
[gd_scene load_steps=231 format=3 uid="uid://bli0t0d6ommvi"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://cvr1qimxpignl" path="res://src/enemy/EnemyModelView2D.cs" id="1_oh25a"]
|
||||
[ext_resource type="Texture2D" uid="uid://nps7rrvkgews" path="res://src/enemy/enemy_types/04. sara/animations/IDLE+MOVE/FRONT/0001.png" id="2_8j76g"]
|
||||
@@ -163,7 +163,10 @@
|
||||
[ext_resource type="Texture2D" uid="uid://n2c8kfwt6ve3" path="res://src/enemy/enemy_types/04. sara/animations/ATTACK2/SIDE R/0019.png" id="160_r8ggx"]
|
||||
[ext_resource type="Texture2D" uid="uid://dykb4rwua8iyw" path="res://src/enemy/enemy_types/04. sara/animations/ATTACK2/SIDE R/0022.png" id="161_xafpd"]
|
||||
[ext_resource type="PackedScene" uid="uid://diaxvpmwgl65u" path="res://src/enemy/TwoAttacksEnemyAnimationTree.tscn" id="163_e6etm"]
|
||||
[ext_resource type="AnimationNodeStateMachine" uid="uid://co7lshemjrro8" path="res://src/enemy/animation_state_machines/IdleStateMachine.tres" id="164_fc7i0"]
|
||||
[ext_resource type="Texture2D" uid="uid://cxibdrta6imfb" path="res://src/vfx/Enemy/nega.png" id="164_rrjme"]
|
||||
[ext_resource type="AnimationNodeStateMachine" uid="uid://cbq8xog50cjjy" path="res://src/enemy/animation_state_machines/PrimaryAttackStateMachine.tres" id="165_veo2p"]
|
||||
[ext_resource type="AnimationNodeStateMachine" uid="uid://clybvwx3itfeo" path="res://src/enemy/animation_state_machines/SecondaryAttackStateMachine.tres" id="166_xppqu"]
|
||||
|
||||
[sub_resource type="ViewportTexture" id="ViewportTexture_h1kaf"]
|
||||
viewport_path = NodePath("Sprite3D/SubViewportContainer/SubViewport")
|
||||
@@ -1310,6 +1313,57 @@ tracks/3/keys = {
|
||||
"times": PackedFloat32Array(0)
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_gv7gi"]
|
||||
resource_name = "secondary_attack_back"
|
||||
length = 0.583341
|
||||
step = 0.0833333
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("Sprite3D/SubViewportContainer/SubViewport/AnimatedSprite:animation")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 1,
|
||||
"values": [&"secondary_attack_back"]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath("Sprite3D/SubViewportContainer/SubViewport/AnimatedSprite:frame")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0, 0.583333),
|
||||
"transitions": PackedFloat32Array(1, 1),
|
||||
"update": 0,
|
||||
"values": [0, 7]
|
||||
}
|
||||
tracks/2/type = "value"
|
||||
tracks/2/imported = false
|
||||
tracks/2/enabled = true
|
||||
tracks/2/path = NodePath("Hitbox/CollisionShape3D:disabled")
|
||||
tracks/2/interp = 1
|
||||
tracks/2/loop_wrap = true
|
||||
tracks/2/keys = {
|
||||
"times": PackedFloat32Array(0, 0.167084, 0.413635),
|
||||
"transitions": PackedFloat32Array(1, 1, 1),
|
||||
"update": 1,
|
||||
"values": [true, false, true]
|
||||
}
|
||||
tracks/3/type = "animation"
|
||||
tracks/3/imported = false
|
||||
tracks/3/enabled = true
|
||||
tracks/3/path = NodePath("Secondary Animation Player")
|
||||
tracks/3/interp = 1
|
||||
tracks/3/loop_wrap = true
|
||||
tracks/3/keys = {
|
||||
"clips": PackedStringArray("Attack VFX"),
|
||||
"times": PackedFloat32Array(0)
|
||||
}
|
||||
|
||||
[sub_resource type="AnimationLibrary" id="AnimationLibrary_pkiq5"]
|
||||
_data = {
|
||||
&"RESET": SubResource("Animation_pkiq5"),
|
||||
@@ -1326,10 +1380,35 @@ _data = {
|
||||
&"primary_attack_left": SubResource("Animation_fc7i0"),
|
||||
&"primary_attack_right": SubResource("Animation_veo2p"),
|
||||
&"secondary_attack": SubResource("Animation_wtyys"),
|
||||
&"secondary_attack_back": SubResource("Animation_gv7gi"),
|
||||
&"secondary_attack_left": SubResource("Animation_qbkgi"),
|
||||
&"secondary_attack_right": SubResource("Animation_k1pc0")
|
||||
}
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_qbkgi"]
|
||||
advance_mode = 2
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_k1pc0"]
|
||||
switch_mode = 2
|
||||
advance_mode = 2
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_hi3ny"]
|
||||
switch_mode = 2
|
||||
advance_mode = 2
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_8wlnr"]
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_gv7gi"]
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachine" id="AnimationNodeStateMachine_rasxg"]
|
||||
states/Idle/node = ExtResource("164_fc7i0")
|
||||
states/Idle/position = Vector2(384, 100)
|
||||
"states/Primary Attack/node" = ExtResource("165_veo2p")
|
||||
"states/Primary Attack/position" = Vector2(384, 264)
|
||||
"states/Secondary Attack/node" = ExtResource("166_xppqu")
|
||||
"states/Secondary Attack/position" = Vector2(638, 264)
|
||||
transitions = ["Start", "Idle", SubResource("AnimationNodeStateMachineTransition_qbkgi"), "Primary Attack", "Idle", SubResource("AnimationNodeStateMachineTransition_k1pc0"), "Secondary Attack", "Idle", SubResource("AnimationNodeStateMachineTransition_hi3ny"), "Idle", "Primary Attack", SubResource("AnimationNodeStateMachineTransition_8wlnr"), "Idle", "Secondary Attack", SubResource("AnimationNodeStateMachineTransition_gv7gi")]
|
||||
|
||||
[sub_resource type="AtlasTexture" id="AtlasTexture_nbpma"]
|
||||
atlas = ExtResource("164_rrjme")
|
||||
region = Rect2(0, 0, 512, 512)
|
||||
@@ -1626,6 +1705,7 @@ _data = {
|
||||
[node name="EnemyModelView" type="Node3D"]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.31442, 0)
|
||||
script = ExtResource("1_oh25a")
|
||||
_enemyDirection = 1
|
||||
|
||||
[node name="Sprite3D" type="Sprite3D" parent="."]
|
||||
transform = Transform3D(1.5, 0, 0, 0, 1.5, 0, 0, 0, 1.5, 0, 0, 0)
|
||||
@@ -1675,6 +1755,8 @@ libraries = {
|
||||
|
||||
[node name="AnimationTree" parent="." instance=ExtResource("163_e6etm")]
|
||||
unique_name_in_owner = true
|
||||
tree_root = SubResource("AnimationNodeStateMachine_rasxg")
|
||||
advance_expression_base_node = NodePath("..")
|
||||
|
||||
[node name="AnimatedSprite3D" type="AnimatedSprite3D" parent="."]
|
||||
transform = Transform3D(0.6, 0, 0, 0, 0.6, 0, 0, 0, 0.6, -0.0335064, -0.0871174, -0.40289)
|
||||
|
||||
@@ -27,14 +27,14 @@ public partial class Ballos : FollowsPlayerEnemy, IHasPrimaryAttack, IHasSeconda
|
||||
public void OnReady()
|
||||
{
|
||||
SetPhysicsProcess(true);
|
||||
((EnemyModelView2D)_enemyModelView).Hitbox.AreaEntered += Hitbox_AreaEntered;
|
||||
((EnemyModelView2D)EnemyModelView).Hitbox.AreaEntered += Hitbox_AreaEntered;
|
||||
}
|
||||
|
||||
public void OnPhysicsProcess(double delta)
|
||||
{
|
||||
_enemyLogic.Input(new EnemyLogic.Input.PhysicsTick(delta));
|
||||
FollowPlayerAndAttack(_enemyLogic, GlobalPosition, _player.CurrentPosition);
|
||||
_navigationAgentClient.CalculateVelocity(GlobalPosition, true);
|
||||
Velocity = _navigationAgentClient.Velocity;
|
||||
base._PhysicsProcess(delta);
|
||||
}
|
||||
|
||||
@@ -48,18 +48,17 @@ public partial class Ballos : FollowsPlayerEnemy, IHasPrimaryAttack, IHasSeconda
|
||||
|
||||
public override void Die()
|
||||
{
|
||||
_navigationAgentClient.Stop();
|
||||
base.Die();
|
||||
}
|
||||
|
||||
public void PrimaryAttack()
|
||||
{
|
||||
_enemyModelView.PlayPrimaryAttackAnimation();
|
||||
EnemyModelView.PlayPrimaryAttackAnimation();
|
||||
}
|
||||
|
||||
public void SecondaryAttack()
|
||||
{
|
||||
_enemyModelView.PlaySecondaryAttackAnimation();
|
||||
EnemyModelView.PlaySecondaryAttackAnimation();
|
||||
}
|
||||
|
||||
public override void SetTarget(Vector3 target) => _navigationAgentClient.SetTarget(target);
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -14,8 +14,6 @@ public partial class Chariot : FollowsPlayerEnemy, IHasPrimaryAttack, ICanActiva
|
||||
[Export]
|
||||
public double PrimaryAttackElementalDamageBonus { get; set; } = 1.0;
|
||||
|
||||
[Node] public ChariotModelView EnemyModelView { get; set; } = default;
|
||||
|
||||
[Node] private INavigationAgentClient _navigationAgentClient { get; set; } = default!;
|
||||
|
||||
private bool _activated = false;
|
||||
@@ -28,7 +26,7 @@ public partial class Chariot : FollowsPlayerEnemy, IHasPrimaryAttack, ICanActiva
|
||||
if (_activated)
|
||||
_movementSpeed = 0;
|
||||
|
||||
_navigationAgentClient.CalculateVelocity(GlobalPosition, true);
|
||||
Velocity = _navigationAgentClient.Velocity;
|
||||
base._PhysicsProcess(delta);
|
||||
}
|
||||
|
||||
@@ -41,20 +39,19 @@ public partial class Chariot : FollowsPlayerEnemy, IHasPrimaryAttack, ICanActiva
|
||||
if (!lookDir.IsEqualApprox(GlobalPosition))
|
||||
LookAt(lookDir, Vector3.Up, true);
|
||||
|
||||
_enemyModelView.SetCurrentDirection(GlobalBasis, -_player.CurrentBasis.Z);
|
||||
base.EnemyModelView.SetCurrentDirection(GlobalBasis, -_player.CurrentBasis.Z);
|
||||
|
||||
if (_enemyModelView is EnemyModelView2D && !_activated)
|
||||
if (base.EnemyModelView is EnemyModelView2D && !_activated)
|
||||
{
|
||||
if (Velocity > Vector3.Zero)
|
||||
_enemyModelView.PlayWalkAnimation();
|
||||
base.EnemyModelView.PlayWalkAnimation();
|
||||
else
|
||||
_enemyModelView.PlayIdleAnimation();
|
||||
base.EnemyModelView.PlayIdleAnimation();
|
||||
}
|
||||
}
|
||||
|
||||
public override void Die()
|
||||
{
|
||||
_navigationAgentClient.Stop();
|
||||
base.Die();
|
||||
}
|
||||
|
||||
@@ -64,7 +61,7 @@ public partial class Chariot : FollowsPlayerEnemy, IHasPrimaryAttack, ICanActiva
|
||||
}
|
||||
public void PrimaryAttack()
|
||||
{
|
||||
_enemyModelView.PlayPrimaryAttackAnimation();
|
||||
base.EnemyModelView.PlayPrimaryAttackAnimation();
|
||||
}
|
||||
|
||||
public void Activate()
|
||||
@@ -72,7 +69,7 @@ public partial class Chariot : FollowsPlayerEnemy, IHasPrimaryAttack, ICanActiva
|
||||
if (_activated)
|
||||
return;
|
||||
|
||||
EnemyModelView.Activate();
|
||||
EnemyModelView.PlayActivateAnimation();
|
||||
_activated = true;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,130 +0,0 @@
|
||||
using Chickensoft.AutoInject;
|
||||
using Chickensoft.Introspection;
|
||||
using Godot;
|
||||
|
||||
namespace Zennysoft.Game.Ma;
|
||||
|
||||
[Meta(typeof(IAutoNode))]
|
||||
public partial class ChariotModelView : EnemyModelView2D, ICanActivate
|
||||
{
|
||||
public override void _Notification(int what) => this.Notify(what);
|
||||
|
||||
private const string APPEAR_FRONT = "appear_front";
|
||||
private const string APPEAR_LEFT = "appear_left";
|
||||
private const string APPEAR_RIGHT = "appear_right";
|
||||
private const string APPEAR_BACK = "appear_back";
|
||||
private const string FRONT = "front";
|
||||
private const string LEFT = "left";
|
||||
private const string RIGHT = "right";
|
||||
private const string BACK = "back";
|
||||
|
||||
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";
|
||||
|
||||
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 bool _activated = false;
|
||||
private bool _activating = false;
|
||||
private bool _scrollsActivating = false;
|
||||
|
||||
[Node] public AnimationTree ScrollAnimationTree { get; set; } = default!;
|
||||
|
||||
public void Setup()
|
||||
{
|
||||
AnimationTree.AnimationFinished += AnimationTree_AnimationFinished;
|
||||
ScrollAnimationTree.AnimationFinished += ScrollAnimationTree_AnimationFinished;
|
||||
}
|
||||
|
||||
public override void _Process(double delta)
|
||||
{
|
||||
if (!_activated)
|
||||
return;
|
||||
|
||||
if (_activating)
|
||||
{
|
||||
PlayActivationAnimation();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
public void Activate()
|
||||
{
|
||||
_activated = true;
|
||||
_activating = true;
|
||||
_scrollsActivating = true;
|
||||
PlayActivationAnimation();
|
||||
}
|
||||
|
||||
public override void PlayIdleAnimation()
|
||||
{
|
||||
if (_activated)
|
||||
{
|
||||
switch (_currentDirection)
|
||||
{
|
||||
case DirectionType.FORWARD:
|
||||
AnimationTree.Get(PARAMETERS_PLAYBACK).As<AnimationNodeStateMachinePlayback>().Travel(ACTIVATED_IDLE_FRONT);
|
||||
ScrollAnimationTree.Get(PARAMETERS_PLAYBACK).As<AnimationNodeStateMachinePlayback>().Travel(FRONT);
|
||||
break;
|
||||
case DirectionType.LEFT:
|
||||
AnimationTree.Get(PARAMETERS_PLAYBACK).As<AnimationNodeStateMachinePlayback>().Travel(ACTIVATED_IDLE_LEFT);
|
||||
ScrollAnimationTree.Get(PARAMETERS_PLAYBACK).As<AnimationNodeStateMachinePlayback>().Travel(LEFT);
|
||||
break;
|
||||
case DirectionType.RIGHT:
|
||||
AnimationTree.Get(PARAMETERS_PLAYBACK).As<AnimationNodeStateMachinePlayback>().Travel(ACTIVATED_IDLE_RIGHT);
|
||||
ScrollAnimationTree.Get(PARAMETERS_PLAYBACK).As<AnimationNodeStateMachinePlayback>().Travel(RIGHT);
|
||||
break;
|
||||
case DirectionType.BACKWARD:
|
||||
AnimationTree.Get(PARAMETERS_PLAYBACK).As<AnimationNodeStateMachinePlayback>().Travel(ACTIVATED_IDLE_BACK);
|
||||
ScrollAnimationTree.Get(PARAMETERS_PLAYBACK).As<AnimationNodeStateMachinePlayback>().Travel(BACK);
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
base.PlayIdleAnimation();
|
||||
}
|
||||
}
|
||||
|
||||
private void PlayActivationAnimation()
|
||||
{
|
||||
switch (_currentDirection)
|
||||
{
|
||||
case DirectionType.FORWARD:
|
||||
AnimationTree.Get(PARAMETERS_PLAYBACK).As<AnimationNodeStateMachinePlayback>().Travel(ACTIVATE);
|
||||
if (_scrollsActivating)
|
||||
ScrollAnimationTree.Get(PARAMETERS_PLAYBACK).As<AnimationNodeStateMachinePlayback>().Travel(APPEAR_FRONT);
|
||||
break;
|
||||
case DirectionType.LEFT:
|
||||
AnimationTree.Get(PARAMETERS_PLAYBACK).As<AnimationNodeStateMachinePlayback>().Travel(ACTIVATE_LEFT);
|
||||
if (_scrollsActivating)
|
||||
ScrollAnimationTree.Get(PARAMETERS_PLAYBACK).As<AnimationNodeStateMachinePlayback>().Travel(APPEAR_LEFT);
|
||||
break;
|
||||
case DirectionType.RIGHT:
|
||||
AnimationTree.Get(PARAMETERS_PLAYBACK).As<AnimationNodeStateMachinePlayback>().Travel(ACTIVATE_RIGHT);
|
||||
if (_scrollsActivating)
|
||||
ScrollAnimationTree.Get(PARAMETERS_PLAYBACK).As<AnimationNodeStateMachinePlayback>().Travel(APPEAR_RIGHT);
|
||||
break;
|
||||
case DirectionType.BACKWARD:
|
||||
AnimationTree.Get(PARAMETERS_PLAYBACK).As<AnimationNodeStateMachinePlayback>().Travel(ACTIVATE_BACK);
|
||||
if (_scrollsActivating)
|
||||
ScrollAnimationTree.Get(PARAMETERS_PLAYBACK).As<AnimationNodeStateMachinePlayback>().Travel(APPEAR_BACK);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void AnimationTree_AnimationFinished(StringName animName)
|
||||
{
|
||||
if (_activating && (animName == ACTIVATE || animName == ACTIVATE_LEFT || animName == ACTIVATE_RIGHT || animName == ACTIVATE_BACK))
|
||||
_activating = false;
|
||||
}
|
||||
private void ScrollAnimationTree_AnimationFinished(StringName animName)
|
||||
{
|
||||
if (_activating && (animName == APPEAR_FRONT || animName == APPEAR_LEFT || animName == APPEAR_RIGHT || animName == APPEAR_BACK))
|
||||
_scrollsActivating = false;
|
||||
}
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -19,12 +19,9 @@ public partial class Chinthe : FollowsPlayerEnemy, IHasPrimaryAttack, ICanPatrol
|
||||
|
||||
[Node] private INavigationAgentClient _navigationAgentClient { get; set; } = default!;
|
||||
|
||||
[Node] private ChintheModelView EnemyModelView { get; set; } = default!;
|
||||
|
||||
public void OnReady()
|
||||
{
|
||||
SetPhysicsProcess(true);
|
||||
EnemyModelView.Hitbox.AreaEntered += Hitbox_AreaEntered;
|
||||
}
|
||||
|
||||
public void OnPhysicsProcess(double delta)
|
||||
@@ -34,13 +31,12 @@ public partial class Chinthe : FollowsPlayerEnemy, IHasPrimaryAttack, ICanPatrol
|
||||
|
||||
_enemyLogic.Input(new EnemyLogic.Input.PhysicsTick(delta));
|
||||
FollowPlayerAndAttack(_enemyLogic, GlobalPosition, _player.CurrentPosition);
|
||||
_navigationAgentClient.CalculateVelocity(GlobalPosition, true);
|
||||
Velocity = _navigationAgentClient.Velocity;
|
||||
base._PhysicsProcess(delta);
|
||||
}
|
||||
|
||||
public override void Die()
|
||||
{
|
||||
_navigationAgentClient.Stop();
|
||||
base.Die();
|
||||
}
|
||||
|
||||
@@ -51,7 +47,7 @@ public partial class Chinthe : FollowsPlayerEnemy, IHasPrimaryAttack, ICanPatrol
|
||||
|
||||
public void PrimaryAttack()
|
||||
{
|
||||
_enemyModelView.PlayPrimaryAttackAnimation();
|
||||
EnemyModelView.PlayPrimaryAttackAnimation();
|
||||
}
|
||||
|
||||
public override void SetTarget(Vector3 target) => _navigationAgentClient.SetTarget(target);
|
||||
@@ -67,12 +63,12 @@ public partial class Chinthe : FollowsPlayerEnemy, IHasPrimaryAttack, ICanPatrol
|
||||
|
||||
public void Activate()
|
||||
{
|
||||
EnemyModelView.Activate();
|
||||
EnemyModelView.PlayActivateAnimation();
|
||||
}
|
||||
|
||||
public void Teleport()
|
||||
{
|
||||
EnemyModelView.PlayTeleportAnimation();
|
||||
//EnemyModelView.PlayTeleportAnimation();
|
||||
}
|
||||
|
||||
private void Hitbox_AreaEntered(Area3D area)
|
||||
|
||||
@@ -1,106 +0,0 @@
|
||||
using Chickensoft.AutoInject;
|
||||
using Chickensoft.Introspection;
|
||||
using Godot;
|
||||
|
||||
namespace Zennysoft.Game.Ma;
|
||||
[Meta(typeof(IAutoNode))]
|
||||
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 = "activate";
|
||||
private const string ACTIVATE_LEFT = "activate_left";
|
||||
private const string ACTIVATE_RIGHT = "activate_right";
|
||||
private const string ACTIVATE_BACK = "activate_back";
|
||||
|
||||
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";
|
||||
|
||||
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);
|
||||
_activated = true;
|
||||
}
|
||||
|
||||
public void PlayActivateLeftAnimation()
|
||||
{
|
||||
AnimationTree.Get(PARAMETERS_PLAYBACK).As<AnimationNodeStateMachinePlayback>().Travel(ACTIVATE_LEFT);
|
||||
_activated = true;
|
||||
}
|
||||
|
||||
public void PlayActivateBackAnimation()
|
||||
{
|
||||
AnimationTree.Get(PARAMETERS_PLAYBACK).As<AnimationNodeStateMachinePlayback>().Travel(ACTIVATE_BACK);
|
||||
_activated = true;
|
||||
}
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
uid://l03h4elwjitu
|
||||
@@ -27,14 +27,14 @@ public partial class Ambassador : FollowsPlayerEnemy, IHasPrimaryAttack, IHasSec
|
||||
public void OnReady()
|
||||
{
|
||||
SetPhysicsProcess(true);
|
||||
((EnemyModelView2D)_enemyModelView).Hitbox.AreaEntered += Hitbox_AreaEntered;
|
||||
((EnemyModelView2D)EnemyModelView).Hitbox.AreaEntered += Hitbox_AreaEntered;
|
||||
}
|
||||
|
||||
public void OnPhysicsProcess(double delta)
|
||||
{
|
||||
_enemyLogic.Input(new EnemyLogic.Input.PhysicsTick(delta));
|
||||
FollowPlayerAndAttack(_enemyLogic, GlobalPosition, _player.CurrentPosition);
|
||||
_navigationAgentClient.CalculateVelocity(GlobalPosition, true);
|
||||
Velocity = _navigationAgentClient.Velocity;
|
||||
base._PhysicsProcess(delta);
|
||||
}
|
||||
|
||||
@@ -48,18 +48,17 @@ public partial class Ambassador : FollowsPlayerEnemy, IHasPrimaryAttack, IHasSec
|
||||
|
||||
public override void Die()
|
||||
{
|
||||
_navigationAgentClient.Stop();
|
||||
base.Die();
|
||||
}
|
||||
|
||||
public void PrimaryAttack()
|
||||
{
|
||||
_enemyModelView.PlayPrimaryAttackAnimation();
|
||||
EnemyModelView.PlayPrimaryAttackAnimation();
|
||||
}
|
||||
|
||||
public void SecondaryAttack()
|
||||
{
|
||||
_enemyModelView.PlaySecondaryAttackAnimation();
|
||||
EnemyModelView.PlaySecondaryAttackAnimation();
|
||||
}
|
||||
|
||||
public override void SetTarget(Vector3 target) => _navigationAgentClient.SetTarget(target);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
[gd_scene load_steps=284 format=3 uid="uid://c2i8ylr3y0bri"]
|
||||
[gd_scene load_steps=298 format=3 uid="uid://c2i8ylr3y0bri"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://cvr1qimxpignl" path="res://src/enemy/EnemyModelView2D.cs" id="1_h27bt"]
|
||||
[ext_resource type="Script" uid="uid://dlsgyx4i1jmp3" path="res://src/enemy/EnemyLoreInfo.cs" id="2_yyynn"]
|
||||
@@ -260,6 +260,10 @@
|
||||
[ext_resource type="Texture2D" uid="uid://jcs07eo1xqtj" path="res://src/enemy/enemy_types/08a. Ambassador/animations/SIDE/Layer 171.png" id="258_q2wum"]
|
||||
[ext_resource type="Texture2D" uid="uid://btrum7jo404t0" path="res://src/enemy/enemy_types/08a. Ambassador/animations/SIDE/Layer 172.png" id="259_br04c"]
|
||||
[ext_resource type="PackedScene" uid="uid://diaxvpmwgl65u" path="res://src/enemy/TwoAttacksEnemyAnimationTree.tscn" id="261_a705x"]
|
||||
[ext_resource type="AnimationNodeStateMachine" uid="uid://co7lshemjrro8" path="res://src/enemy/animation_state_machines/IdleStateMachine.tres" id="262_rmbbl"]
|
||||
[ext_resource type="AnimationNodeStateMachine" uid="uid://cy2ngl55c0rws" path="res://src/enemy/animation_state_machines/WalkingStateMachine.tres" id="263_312rt"]
|
||||
[ext_resource type="AnimationNodeStateMachine" uid="uid://cbq8xog50cjjy" path="res://src/enemy/animation_state_machines/PrimaryAttackStateMachine.tres" id="263_sroq1"]
|
||||
[ext_resource type="AnimationNodeStateMachine" uid="uid://clybvwx3itfeo" path="res://src/enemy/animation_state_machines/SecondaryAttackStateMachine.tres" id="264_dcx20"]
|
||||
[ext_resource type="Script" uid="uid://6edayafleq8y" path="res://src/hitbox/Hitbox.cs" id="333_u3b1r"]
|
||||
|
||||
[sub_resource type="Resource" id="Resource_f45wt"]
|
||||
@@ -1838,9 +1842,44 @@ _data = {
|
||||
&"secondary_attack_right": SubResource("Animation_xe0e6")
|
||||
}
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_sroq1"]
|
||||
advance_mode = 2
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_dcx20"]
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_evddb"]
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_lqnm4"]
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_mwcs5"]
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_6v3gw"]
|
||||
switch_mode = 2
|
||||
advance_mode = 2
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_1f6b3"]
|
||||
switch_mode = 2
|
||||
advance_mode = 2
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_vw1ok"]
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_nau3d"]
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachine" id="AnimationNodeStateMachine_sroq1"]
|
||||
states/Idle/node = ExtResource("262_rmbbl")
|
||||
states/Idle/position = Vector2(371, 100)
|
||||
"states/Primary Attack/node" = ExtResource("263_sroq1")
|
||||
"states/Primary Attack/position" = Vector2(355, 236)
|
||||
"states/Secondary Attack/node" = ExtResource("264_dcx20")
|
||||
"states/Secondary Attack/position" = Vector2(690, 244)
|
||||
states/Walking/node = ExtResource("263_312rt")
|
||||
states/Walking/position = Vector2(635, 100)
|
||||
transitions = ["Start", "Idle", SubResource("AnimationNodeStateMachineTransition_sroq1"), "Idle", "Walking", SubResource("AnimationNodeStateMachineTransition_dcx20"), "Walking", "Idle", SubResource("AnimationNodeStateMachineTransition_evddb"), "Idle", "Primary Attack", SubResource("AnimationNodeStateMachineTransition_lqnm4"), "Idle", "Secondary Attack", SubResource("AnimationNodeStateMachineTransition_mwcs5"), "Primary Attack", "Idle", SubResource("AnimationNodeStateMachineTransition_6v3gw"), "Secondary Attack", "Idle", SubResource("AnimationNodeStateMachineTransition_1f6b3"), "Walking", "Primary Attack", SubResource("AnimationNodeStateMachineTransition_vw1ok"), "Walking", "Secondary Attack", SubResource("AnimationNodeStateMachineTransition_nau3d")]
|
||||
|
||||
[node name="EnemyModelView" type="Node3D"]
|
||||
script = ExtResource("1_h27bt")
|
||||
EnemyLoreInfo = SubResource("Resource_f45wt")
|
||||
_enemyDirection = 3
|
||||
|
||||
[node name="Sprite3D" type="Sprite3D" parent="."]
|
||||
transform = Transform3D(1.5, 0, 0, 0, 1.5, 0, 0, 0, 1.5, 0, 0.545209, 0)
|
||||
@@ -1890,3 +1929,5 @@ libraries = {
|
||||
|
||||
[node name="AnimationTree" parent="." instance=ExtResource("261_a705x")]
|
||||
unique_name_in_owner = true
|
||||
tree_root = SubResource("AnimationNodeStateMachine_sroq1")
|
||||
advance_expression_base_node = NodePath("..")
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
[gd_scene load_steps=285 format=3 uid="uid://72lbcmp4bcx4"]
|
||||
[gd_scene load_steps=299 format=3 uid="uid://72lbcmp4bcx4"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://cvr1qimxpignl" path="res://src/enemy/EnemyModelView2D.cs" id="1_a8qtn"]
|
||||
[ext_resource type="Script" uid="uid://dlsgyx4i1jmp3" path="res://src/enemy/EnemyLoreInfo.cs" id="2_xa3ug"]
|
||||
@@ -262,6 +262,10 @@
|
||||
[ext_resource type="Texture2D" uid="uid://by2vqyh68egwr" path="res://src/enemy/enemy_types/08b. Ambassador (red)/animations/SIDE/0199.png" id="260_jtq5d"]
|
||||
[ext_resource type="Script" uid="uid://6edayafleq8y" path="res://src/hitbox/Hitbox.cs" id="261_uny2s"]
|
||||
[ext_resource type="PackedScene" uid="uid://diaxvpmwgl65u" path="res://src/enemy/TwoAttacksEnemyAnimationTree.tscn" id="262_a3dro"]
|
||||
[ext_resource type="AnimationNodeStateMachine" uid="uid://co7lshemjrro8" path="res://src/enemy/animation_state_machines/IdleStateMachine.tres" id="263_qerwx"]
|
||||
[ext_resource type="AnimationNodeStateMachine" uid="uid://cbq8xog50cjjy" path="res://src/enemy/animation_state_machines/PrimaryAttackStateMachine.tres" id="264_xxvov"]
|
||||
[ext_resource type="AnimationNodeStateMachine" uid="uid://clybvwx3itfeo" path="res://src/enemy/animation_state_machines/SecondaryAttackStateMachine.tres" id="265_pta34"]
|
||||
[ext_resource type="AnimationNodeStateMachine" uid="uid://cy2ngl55c0rws" path="res://src/enemy/animation_state_machines/WalkingStateMachine.tres" id="266_0cp06"]
|
||||
|
||||
[sub_resource type="Resource" id="Resource_f45wt"]
|
||||
script = ExtResource("2_xa3ug")
|
||||
@@ -1842,9 +1846,44 @@ _data = {
|
||||
&"secondary_attack_right": SubResource("Animation_xe0e6")
|
||||
}
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_oceba"]
|
||||
advance_mode = 2
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_yqco6"]
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_ikyxn"]
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_2y5m2"]
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_dyptf"]
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_7vwa6"]
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_i3uxw"]
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_ig6n6"]
|
||||
switch_mode = 2
|
||||
advance_mode = 2
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_8fqp0"]
|
||||
switch_mode = 2
|
||||
advance_mode = 2
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachine" id="AnimationNodeStateMachine_1o3cs"]
|
||||
states/Idle/node = ExtResource("263_qerwx")
|
||||
states/Idle/position = Vector2(375, 100)
|
||||
"states/Primary Attack/node" = ExtResource("264_xxvov")
|
||||
"states/Primary Attack/position" = Vector2(375, 281)
|
||||
"states/Secondary Attack/node" = ExtResource("265_pta34")
|
||||
"states/Secondary Attack/position" = Vector2(652, 281)
|
||||
states/Walking/node = ExtResource("266_0cp06")
|
||||
states/Walking/position = Vector2(652, 100)
|
||||
transitions = ["Start", "Idle", SubResource("AnimationNodeStateMachineTransition_oceba"), "Idle", "Walking", SubResource("AnimationNodeStateMachineTransition_yqco6"), "Walking", "Idle", SubResource("AnimationNodeStateMachineTransition_ikyxn"), "Idle", "Primary Attack", SubResource("AnimationNodeStateMachineTransition_2y5m2"), "Walking", "Primary Attack", SubResource("AnimationNodeStateMachineTransition_dyptf"), "Walking", "Secondary Attack", SubResource("AnimationNodeStateMachineTransition_7vwa6"), "Idle", "Secondary Attack", SubResource("AnimationNodeStateMachineTransition_i3uxw"), "Primary Attack", "Idle", SubResource("AnimationNodeStateMachineTransition_ig6n6"), "Secondary Attack", "Idle", SubResource("AnimationNodeStateMachineTransition_8fqp0")]
|
||||
|
||||
[node name="EnemyModelView" type="Node3D"]
|
||||
script = ExtResource("1_a8qtn")
|
||||
EnemyLoreInfo = SubResource("Resource_f45wt")
|
||||
_enemyDirection = 1
|
||||
|
||||
[node name="Sprite3D" type="Sprite3D" parent="."]
|
||||
transform = Transform3D(1.5, 0, 0, 0, 1.5, 0, 0, 0, 1.5, 0, 0.487989, 0)
|
||||
@@ -1897,3 +1936,5 @@ libraries = {
|
||||
|
||||
[node name="AnimationTree" parent="." instance=ExtResource("262_a3dro")]
|
||||
unique_name_in_owner = true
|
||||
tree_root = SubResource("AnimationNodeStateMachine_1o3cs")
|
||||
advance_expression_base_node = NodePath("..")
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
[gd_scene load_steps=285 format=3 uid="uid://lc5koiqn1sca"]
|
||||
[gd_scene load_steps=299 format=3 uid="uid://lc5koiqn1sca"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://cvr1qimxpignl" path="res://src/enemy/EnemyModelView2D.cs" id="1_s0qsg"]
|
||||
[ext_resource type="Script" uid="uid://dlsgyx4i1jmp3" path="res://src/enemy/EnemyLoreInfo.cs" id="2_84ebe"]
|
||||
@@ -262,6 +262,10 @@
|
||||
[ext_resource type="Texture2D" uid="uid://biaen4nwf0tpg" path="res://src/enemy/enemy_types/08c. Ambassador (steel)/animations/SIDE/Layer 258.png" id="260_3ft46"]
|
||||
[ext_resource type="Script" uid="uid://6edayafleq8y" path="res://src/hitbox/Hitbox.cs" id="261_jsntq"]
|
||||
[ext_resource type="PackedScene" uid="uid://diaxvpmwgl65u" path="res://src/enemy/TwoAttacksEnemyAnimationTree.tscn" id="262_47uje"]
|
||||
[ext_resource type="AnimationNodeStateMachine" uid="uid://co7lshemjrro8" path="res://src/enemy/animation_state_machines/IdleStateMachine.tres" id="263_i2vbx"]
|
||||
[ext_resource type="AnimationNodeStateMachine" uid="uid://cbq8xog50cjjy" path="res://src/enemy/animation_state_machines/PrimaryAttackStateMachine.tres" id="264_5tr5n"]
|
||||
[ext_resource type="AnimationNodeStateMachine" uid="uid://clybvwx3itfeo" path="res://src/enemy/animation_state_machines/SecondaryAttackStateMachine.tres" id="265_yj1cx"]
|
||||
[ext_resource type="AnimationNodeStateMachine" uid="uid://cy2ngl55c0rws" path="res://src/enemy/animation_state_machines/WalkingStateMachine.tres" id="266_jq47d"]
|
||||
|
||||
[sub_resource type="Resource" id="Resource_f45wt"]
|
||||
script = ExtResource("2_84ebe")
|
||||
@@ -1842,9 +1846,44 @@ _data = {
|
||||
&"secondary_attack_right": SubResource("Animation_xe0e6")
|
||||
}
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_e2v6u"]
|
||||
advance_mode = 2
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_elcn4"]
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_jiwbc"]
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_7w85o"]
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_13xt0"]
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_pn6rj"]
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_ohtvb"]
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_rimgk"]
|
||||
switch_mode = 2
|
||||
advance_mode = 2
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachineTransition" id="AnimationNodeStateMachineTransition_v1276"]
|
||||
switch_mode = 2
|
||||
advance_mode = 2
|
||||
|
||||
[sub_resource type="AnimationNodeStateMachine" id="AnimationNodeStateMachine_pjwch"]
|
||||
states/Idle/node = ExtResource("263_i2vbx")
|
||||
states/Idle/position = Vector2(374, 100)
|
||||
"states/Primary Attack/node" = ExtResource("264_5tr5n")
|
||||
"states/Primary Attack/position" = Vector2(369, 214)
|
||||
"states/Secondary Attack/node" = ExtResource("265_yj1cx")
|
||||
"states/Secondary Attack/position" = Vector2(635, 226)
|
||||
states/Walking/node = ExtResource("266_jq47d")
|
||||
states/Walking/position = Vector2(635, 100)
|
||||
transitions = ["Start", "Idle", SubResource("AnimationNodeStateMachineTransition_e2v6u"), "Idle", "Walking", SubResource("AnimationNodeStateMachineTransition_elcn4"), "Walking", "Idle", SubResource("AnimationNodeStateMachineTransition_jiwbc"), "Walking", "Primary Attack", SubResource("AnimationNodeStateMachineTransition_7w85o"), "Walking", "Secondary Attack", SubResource("AnimationNodeStateMachineTransition_13xt0"), "Idle", "Primary Attack", SubResource("AnimationNodeStateMachineTransition_pn6rj"), "Idle", "Secondary Attack", SubResource("AnimationNodeStateMachineTransition_ohtvb"), "Primary Attack", "Idle", SubResource("AnimationNodeStateMachineTransition_rimgk"), "Secondary Attack", "Idle", SubResource("AnimationNodeStateMachineTransition_v1276")]
|
||||
|
||||
[node name="EnemyModelView" type="Node3D"]
|
||||
script = ExtResource("1_s0qsg")
|
||||
EnemyLoreInfo = SubResource("Resource_f45wt")
|
||||
_enemyDirection = 1
|
||||
|
||||
[node name="Sprite3D" type="Sprite3D" parent="."]
|
||||
transform = Transform3D(1.5, 0, 0, 0, 1.5, 0, 0, 0, 1.5, 0, 0.561663, 0)
|
||||
@@ -1894,3 +1933,5 @@ libraries = {
|
||||
|
||||
[node name="AnimationTree" parent="." instance=ExtResource("262_47uje")]
|
||||
unique_name_in_owner = true
|
||||
tree_root = SubResource("AnimationNodeStateMachine_pjwch")
|
||||
advance_expression_base_node = NodePath("..")
|
||||
|
||||
@@ -27,14 +27,14 @@ public partial class AgniDemon : FollowsPlayerEnemy, IHasPrimaryAttack, IHasSeco
|
||||
public void OnReady()
|
||||
{
|
||||
SetPhysicsProcess(true);
|
||||
((EnemyModelView2D)_enemyModelView).Hitbox.AreaEntered += Hitbox_AreaEntered;
|
||||
((EnemyModelView2D)EnemyModelView).Hitbox.AreaEntered += Hitbox_AreaEntered;
|
||||
}
|
||||
|
||||
public void OnPhysicsProcess(double delta)
|
||||
{
|
||||
_enemyLogic.Input(new EnemyLogic.Input.PhysicsTick(delta));
|
||||
FollowPlayerAndAttack(_enemyLogic, GlobalPosition, _player.CurrentPosition);
|
||||
_navigationAgentClient.CalculateVelocity(GlobalPosition, true);
|
||||
Velocity = _navigationAgentClient.Velocity;
|
||||
base._PhysicsProcess(delta);
|
||||
}
|
||||
|
||||
@@ -48,18 +48,17 @@ public partial class AgniDemon : FollowsPlayerEnemy, IHasPrimaryAttack, IHasSeco
|
||||
|
||||
public override void Die()
|
||||
{
|
||||
_navigationAgentClient.Stop();
|
||||
base.Die();
|
||||
}
|
||||
|
||||
public void PrimaryAttack()
|
||||
{
|
||||
_enemyModelView.PlayPrimaryAttackAnimation();
|
||||
EnemyModelView.PlayPrimaryAttackAnimation();
|
||||
}
|
||||
|
||||
public void SecondaryAttack()
|
||||
{
|
||||
_enemyModelView.PlaySecondaryAttackAnimation();
|
||||
EnemyModelView.PlaySecondaryAttackAnimation();
|
||||
}
|
||||
|
||||
public override void SetTarget(Vector3 target) => _navigationAgentClient.SetTarget(target);
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -27,14 +27,14 @@ public partial class Palan : FollowsPlayerEnemy, IHasPrimaryAttack, IHasSecondar
|
||||
public void OnReady()
|
||||
{
|
||||
SetPhysicsProcess(true);
|
||||
((EnemyModelView2D)_enemyModelView).Hitbox.AreaEntered += Hitbox_AreaEntered;
|
||||
((EnemyModelView2D)EnemyModelView).Hitbox.AreaEntered += Hitbox_AreaEntered;
|
||||
}
|
||||
|
||||
public void OnPhysicsProcess(double delta)
|
||||
{
|
||||
_enemyLogic.Input(new EnemyLogic.Input.PhysicsTick(delta));
|
||||
FollowPlayerAndAttack(_enemyLogic, GlobalPosition, _player.CurrentPosition);
|
||||
_navigationAgentClient.CalculateVelocity(GlobalPosition, true);
|
||||
Velocity = _navigationAgentClient.Velocity;
|
||||
base._PhysicsProcess(delta);
|
||||
}
|
||||
|
||||
@@ -48,18 +48,17 @@ public partial class Palan : FollowsPlayerEnemy, IHasPrimaryAttack, IHasSecondar
|
||||
|
||||
public override void Die()
|
||||
{
|
||||
_navigationAgentClient.Stop();
|
||||
base.Die();
|
||||
}
|
||||
|
||||
public void PrimaryAttack()
|
||||
{
|
||||
_enemyModelView.PlayPrimaryAttackAnimation();
|
||||
EnemyModelView.PlayPrimaryAttackAnimation();
|
||||
}
|
||||
|
||||
public void SecondaryAttack()
|
||||
{
|
||||
_enemyModelView.PlaySecondaryAttackAnimation();
|
||||
EnemyModelView.PlaySecondaryAttackAnimation();
|
||||
}
|
||||
|
||||
public override void SetTarget(Vector3 target) => _navigationAgentClient.SetTarget(target);
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -26,16 +26,16 @@ public partial class ShieldOfHeaven : FollowsPlayerEnemy, IHasPrimaryAttack, IHa
|
||||
|
||||
public void OnReady()
|
||||
{
|
||||
SetPhysicsProcess(true);
|
||||
((EnemyModelView2D)_enemyModelView).Hitbox.AreaEntered += Hitbox_AreaEntered;
|
||||
SetPhysicsProcess(true);
|
||||
((EnemyModelView2D)EnemyModelView).Hitbox.AreaEntered += Hitbox_AreaEntered;
|
||||
}
|
||||
|
||||
public void OnPhysicsProcess(double delta)
|
||||
{
|
||||
_enemyLogic.Input(new EnemyLogic.Input.PhysicsTick(delta));
|
||||
FollowPlayerAndAttack(_enemyLogic, GlobalPosition, _player.CurrentPosition);
|
||||
_navigationAgentClient.CalculateVelocity(GlobalPosition, true);
|
||||
base._PhysicsProcess(delta);
|
||||
_enemyLogic.Input(new EnemyLogic.Input.PhysicsTick(delta));
|
||||
FollowPlayerAndAttack(_enemyLogic, GlobalPosition, _player.CurrentPosition);
|
||||
Velocity = _navigationAgentClient.Velocity;
|
||||
base._PhysicsProcess(delta);
|
||||
}
|
||||
|
||||
public override void TakeAction()
|
||||
@@ -48,18 +48,17 @@ public partial class ShieldOfHeaven : FollowsPlayerEnemy, IHasPrimaryAttack, IHa
|
||||
|
||||
public override void Die()
|
||||
{
|
||||
_navigationAgentClient.Stop();
|
||||
base.Die();
|
||||
base.Die();
|
||||
}
|
||||
|
||||
public void PrimaryAttack()
|
||||
{
|
||||
_enemyModelView.PlayPrimaryAttackAnimation();
|
||||
EnemyModelView.PlayPrimaryAttackAnimation();
|
||||
}
|
||||
|
||||
public void SecondaryAttack()
|
||||
{
|
||||
_enemyModelView.PlaySecondaryAttackAnimation();
|
||||
EnemyModelView.PlaySecondaryAttackAnimation();
|
||||
}
|
||||
|
||||
public override void SetTarget(Vector3 target) => _navigationAgentClient.SetTarget(target);
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -2,6 +2,7 @@ using Chickensoft.AutoInject;
|
||||
using Chickensoft.Collections;
|
||||
using Chickensoft.Introspection;
|
||||
using Godot;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using Zennysoft.Ma.Adapter;
|
||||
|
||||
@@ -28,70 +29,80 @@ public partial class DemonWall : CharacterBody3D, IEnemy
|
||||
|
||||
public void OnReady()
|
||||
{
|
||||
CurrentHP = new AutoProp<double>(_enemyStatResource.MaximumHP);
|
||||
_attackTimer = new Timer { WaitTime = 5f };
|
||||
_attackTimer.Timeout += AttackTimer_Timeout;
|
||||
AddChild(_attackTimer);
|
||||
_damageCalculator = new DamageCalculator();
|
||||
CurrentHP.Sync += CurrentHP_Sync;
|
||||
CurrentHP = new AutoProp<double>(_enemyStatResource.MaximumHP);
|
||||
_attackTimer = new Timer { WaitTime = 5f };
|
||||
_attackTimer.Timeout += AttackTimer_Timeout;
|
||||
AddChild(_attackTimer);
|
||||
_damageCalculator = new DamageCalculator();
|
||||
CurrentHP.Sync += CurrentHP_Sync;
|
||||
}
|
||||
|
||||
private void CurrentHP_Sync(double newHP)
|
||||
{
|
||||
if (newHP <= 0)
|
||||
Die();
|
||||
if (newHP <= 0)
|
||||
Die();
|
||||
}
|
||||
|
||||
public void Activate()
|
||||
{
|
||||
EnemyModelView.Activate();
|
||||
SetPhysicsProcess(true);
|
||||
StartAttackTimer();
|
||||
EnemyModelView.PlayActivateAnimation();
|
||||
SetPhysicsProcess(true);
|
||||
StartAttackTimer();
|
||||
}
|
||||
|
||||
private void AttackTimer_Timeout()
|
||||
{
|
||||
TakeAction();
|
||||
TakeAction();
|
||||
}
|
||||
|
||||
public void TakeAction()
|
||||
{
|
||||
EnemyModelView.Attack(_maximumWallMoveAmount);
|
||||
EnemyModelView.Attack(_maximumWallMoveAmount);
|
||||
}
|
||||
|
||||
public void Move(Vector3 velocity) => throw new System.NotImplementedException();
|
||||
|
||||
public void TakeDamage(double damage, ElementType elementType = ElementType.None, bool isCriticalHit = false, bool ignoreDefense = false, bool ignoreElementalResistance = false)
|
||||
{
|
||||
var damageTaken = _damageCalculator.CalculateDamage(
|
||||
damage,
|
||||
elementType,
|
||||
_enemyStatResource.CurrentDefense,
|
||||
_enemyStatResource.ElementalResistance,
|
||||
isCriticalHit,
|
||||
ignoreDefense,
|
||||
ignoreElementalResistance);
|
||||
var damageTaken = _damageCalculator.CalculateDamage(
|
||||
damage,
|
||||
elementType,
|
||||
_enemyStatResource.CurrentDefense,
|
||||
_enemyStatResource.ElementalResistance,
|
||||
isCriticalHit,
|
||||
ignoreDefense,
|
||||
ignoreElementalResistance);
|
||||
|
||||
CurrentHP.OnNext(CurrentHP.Value - damageTaken);
|
||||
GD.Print($"Demon Wall HP Left: {CurrentHP.Value}");
|
||||
EnemyModelView.PlayHitAnimation();
|
||||
CurrentHP.OnNext(CurrentHP.Value - damageTaken);
|
||||
GD.Print($"Demon Wall HP Left: {CurrentHP.Value}");
|
||||
EnemyModelView.PlayHitAnimation();
|
||||
}
|
||||
|
||||
public void Knockback(float impulse, Vector3 direction) => throw new System.NotImplementedException();
|
||||
public void SetCurrentHP(int newHP) => throw new System.NotImplementedException();
|
||||
public void Idle()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void Move()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public void Knockback(float impulse, Vector3 direction) => throw new NotImplementedException();
|
||||
public void SetCurrentHP(int newHP) => throw new NotImplementedException();
|
||||
public int GetMaximumHP() => _enemyStatResource.MaximumHP;
|
||||
public void StartAttackTimer() => _attackTimer.Start();
|
||||
public void StopAttackTimer() => _attackTimer.Stop();
|
||||
public void SetTarget(Vector3 target) => throw new System.NotImplementedException();
|
||||
public void SetEnemyGlobalPosition(Vector3 target) => throw new System.NotImplementedException();
|
||||
public Vector3 GetEnemyGlobalPosition() => throw new System.NotImplementedException();
|
||||
public IDungeonRoom GetCurrentRoom() => throw new System.NotImplementedException();
|
||||
public void SetTarget(Vector3 target) => throw new NotImplementedException();
|
||||
public void SetEnemyGlobalPosition(Vector3 target) => throw new NotImplementedException();
|
||||
public Vector3 GetEnemyGlobalPosition() => throw new NotImplementedException();
|
||||
public IDungeonRoom GetCurrentRoom() => throw new NotImplementedException();
|
||||
|
||||
public async void Die()
|
||||
{
|
||||
CurrentHP.OnCompleted();
|
||||
EnemyModelView.PlayDeathAnimation();
|
||||
await ToSignal(GetTree().CreateTimer(0.8f), "timeout");
|
||||
CallDeferred(MethodName.QueueFree);
|
||||
CurrentHP.OnCompleted();
|
||||
EnemyModelView.PlayDeathAnimation();
|
||||
await ToSignal(GetTree().CreateTimer(0.8f), "timeout");
|
||||
CallDeferred(MethodName.QueueFree);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,81 +24,81 @@ public partial class DemonWallModelView : EnemyModelView3D
|
||||
|
||||
[Node] private AnimatableBody3D _opposingWall { get; set; } = default!;
|
||||
|
||||
public void Activate()
|
||||
public void PlayActivateAnimation()
|
||||
{
|
||||
_opposingWall.Show();
|
||||
var collisionShape = _opposingWall.GetChildren().OfType<CollisionShape3D>().Single();
|
||||
collisionShape.SetDeferred(CollisionShape3D.PropertyName.Disabled, false);
|
||||
SetPhysicsProcess(true);
|
||||
_opposingWall.Show();
|
||||
var collisionShape = _opposingWall.GetChildren().OfType<CollisionShape3D>().Single();
|
||||
collisionShape.SetDeferred(CollisionShape3D.PropertyName.Disabled, false);
|
||||
SetPhysicsProcess(true);
|
||||
}
|
||||
|
||||
public void OnPhysicsProcess(double delta)
|
||||
{
|
||||
var direction = GlobalPosition.DirectionTo(_player.CurrentPosition).Normalized();
|
||||
var rotationAngle = GetRotationAngle(_rotation);
|
||||
RotateToPlayer(Eye, rotationAngle, 1f);
|
||||
var direction = GlobalPosition.DirectionTo(_player.CurrentPosition).Normalized();
|
||||
var rotationAngle = GetRotationAngle(_rotation);
|
||||
RotateToPlayer(Eye, rotationAngle, 1f);
|
||||
}
|
||||
|
||||
public void RotateToPlayer(Node3D rotateObject, float rotationAngle, float timeInSeconds)
|
||||
{
|
||||
var tweener = CreateTween();
|
||||
tweener.TweenMethod(Callable.From((float x) => RotateTowardsPlayer(rotateObject, x)), rotateObject.Rotation.Y, rotationAngle, timeInSeconds);
|
||||
var tweener = CreateTween();
|
||||
tweener.TweenMethod(Callable.From((float x) => RotateTowardsPlayer(rotateObject, x)), rotateObject.Rotation.Y, rotationAngle, timeInSeconds);
|
||||
}
|
||||
|
||||
public async void Attack(double maximumWallMoveAmount)
|
||||
{
|
||||
var rng = new RandomNumberGenerator();
|
||||
rng.Randomize();
|
||||
var rng = new RandomNumberGenerator();
|
||||
rng.Randomize();
|
||||
|
||||
var leftArms = new Godot.Collections.Array<DemonWallArm>(LeftArms.GetChildren().Cast<DemonWallArm>());
|
||||
var rightArms = new Godot.Collections.Array<DemonWallArm>(RightArms.GetChildren().Cast<DemonWallArm>());
|
||||
var leftArms = new Godot.Collections.Array<DemonWallArm>(LeftArms.GetChildren().Cast<DemonWallArm>());
|
||||
var rightArms = new Godot.Collections.Array<DemonWallArm>(RightArms.GetChildren().Cast<DemonWallArm>());
|
||||
|
||||
var leftArm = leftArms.PickRandom();
|
||||
var rightArm = rightArms.PickRandom();
|
||||
var leftArm = leftArms.PickRandom();
|
||||
var rightArm = rightArms.PickRandom();
|
||||
|
||||
leftArm.PrimaryAttack();
|
||||
rightArm.PrimaryAttack();
|
||||
leftArm.PrimaryAttack();
|
||||
rightArm.PrimaryAttack();
|
||||
|
||||
var arm1 = GetNode<DemonWallArm>("%Arm1");
|
||||
var arm2 = GetNode<DemonWallArm>("%Arm2");
|
||||
var arm7 = GetNode<DemonWallArm>("%Arm2");
|
||||
var arm1 = GetNode<DemonWallArm>("%Arm1");
|
||||
var arm2 = GetNode<DemonWallArm>("%Arm2");
|
||||
var arm7 = GetNode<DemonWallArm>("%Arm2");
|
||||
|
||||
if (leftArm == arm1)
|
||||
await AimAtPlayer(arm1, 2.1);
|
||||
if (leftArm == arm2)
|
||||
await AimAtPlayer(arm2, 1.5);
|
||||
if (leftArm == GetNode<DemonWallArm>("%Arm3") && _opposingWall.Position.Z > -maximumWallMoveAmount)
|
||||
MoveWall();
|
||||
if (rightArm == arm7)
|
||||
await AimAtPlayer(arm7, 2.5);
|
||||
if (leftArm == arm1)
|
||||
await AimAtPlayer(arm1, 2.1);
|
||||
if (leftArm == arm2)
|
||||
await AimAtPlayer(arm2, 1.5);
|
||||
if (leftArm == GetNode<DemonWallArm>("%Arm3") && _opposingWall.Position.Z > -maximumWallMoveAmount)
|
||||
MoveWall();
|
||||
if (rightArm == arm7)
|
||||
await AimAtPlayer(arm7, 2.5);
|
||||
}
|
||||
|
||||
private async Task AimAtPlayer(DemonWallArm arm, double animationLengthInSeconds)
|
||||
{
|
||||
var rotationAngle = GetRotationAngle(arm.GetNode<Node3D>("%Rotation"));
|
||||
RotateToPlayer(arm.GetNode<Node3D>("%Pivot"), rotationAngle, 0.3f);
|
||||
await ToSignal(GetTree().CreateTimer(animationLengthInSeconds), "timeout");
|
||||
RotateToPlayer(arm.GetNode<Node3D>("%Pivot"), 0, 0.3f);
|
||||
var rotationAngle = GetRotationAngle(arm.GetNode<Node3D>("%Rotation"));
|
||||
RotateToPlayer(arm.GetNode<Node3D>("%Pivot"), rotationAngle, 0.3f);
|
||||
await ToSignal(GetTree().CreateTimer(animationLengthInSeconds), "timeout");
|
||||
RotateToPlayer(arm.GetNode<Node3D>("%Pivot"), 0, 0.3f);
|
||||
}
|
||||
|
||||
private async void MoveWall()
|
||||
{
|
||||
await ToSignal(GetTree().CreateTimer(1.5f), "timeout");
|
||||
var tweener = CreateTween();
|
||||
tweener.TweenMethod(Callable.From((float x) => MoveWallTowardsPlayer(x)), _opposingWall.Position.Z, _opposingWall.Position.Z - 2, 3f);
|
||||
await ToSignal(GetTree().CreateTimer(1.5f), "timeout");
|
||||
var tweener = CreateTween();
|
||||
tweener.TweenMethod(Callable.From((float x) => MoveWallTowardsPlayer(x)), _opposingWall.Position.Z, _opposingWall.Position.Z - 2, 3f);
|
||||
}
|
||||
|
||||
private void MoveWallTowardsPlayer(float moveAmount)
|
||||
{
|
||||
_opposingWall.Position = new Vector3(_opposingWall.Position.X, _opposingWall.Position.Y, moveAmount);
|
||||
_opposingWall.Position = new Vector3(_opposingWall.Position.X, _opposingWall.Position.Y, moveAmount);
|
||||
}
|
||||
|
||||
private float GetRotationAngle(Node3D rotationNode)
|
||||
{
|
||||
var target = new Vector3(_player.CurrentPosition.X, Position.Y, _player.CurrentPosition.Z);
|
||||
rotationNode.LookAt(target, Vector3.Up, true);
|
||||
rotationNode.RotateY(Rotation.Y);
|
||||
return rotationNode.Rotation.Y;
|
||||
var target = new Vector3(_player.CurrentPosition.X, Position.Y, _player.CurrentPosition.Z);
|
||||
rotationNode.LookAt(target, Vector3.Up, true);
|
||||
rotationNode.RotateY(Rotation.Y);
|
||||
return rotationNode.Rotation.Y;
|
||||
}
|
||||
|
||||
private void RotateTowardsPlayer(Node3D rotationNode, float angle) => rotationNode.Rotation = new Vector3(rotationNode.Rotation.X, angle, rotationNode.Rotation.Z);
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -11,8 +11,14 @@ public partial class EnemyLogic
|
||||
{
|
||||
public Attacking()
|
||||
{
|
||||
OnAttach(() => Get<IEnemy>().StartAttackTimer());
|
||||
OnDetach(() => Get<IEnemy>().StopAttackTimer());
|
||||
OnAttach(() =>
|
||||
{
|
||||
Get<IEnemy>().StartAttackTimer();
|
||||
});
|
||||
OnDetach(() =>
|
||||
{
|
||||
Get<IEnemy>().StopAttackTimer();
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,6 +10,11 @@ public partial class EnemyLogic
|
||||
[Meta, Id("enemy_logic_state_followplayer")]
|
||||
public partial record FollowPlayer : Activated, IGet<Input.PhysicsTick>, IGet<Input.LostPlayer>
|
||||
{
|
||||
public FollowPlayer()
|
||||
{
|
||||
OnAttach(() => Get<IEnemy>().Move());
|
||||
}
|
||||
|
||||
public Transition On(in Input.PhysicsTick input)
|
||||
{
|
||||
var enemy = Get<IEnemy>();
|
||||
|
||||
@@ -10,6 +10,11 @@ public partial class EnemyLogic
|
||||
[Meta, Id("enemy_logic_state_idle")]
|
||||
public partial record Idle : Alive, IGet<Input.StartPatrol>
|
||||
{
|
||||
public Idle()
|
||||
{
|
||||
OnAttach(() => Get<IEnemy>().Idle());
|
||||
}
|
||||
|
||||
public Transition On(in Input.StartPatrol _)
|
||||
{
|
||||
return To<Patrolling>();
|
||||
|
||||
@@ -13,6 +13,11 @@ public partial class EnemyLogic
|
||||
{
|
||||
private Vector3 _patrolTarget { get; set; }
|
||||
|
||||
public Patrolling()
|
||||
{
|
||||
OnAttach(() => Get<IEnemy>().Move());
|
||||
}
|
||||
|
||||
public Transition On(in Input.PhysicsTick input)
|
||||
{
|
||||
var delta = input.Delta;
|
||||
|
||||
@@ -28,8 +28,11 @@ public abstract partial class DungeonRoom : Node3D, IDungeonRoom
|
||||
public void Setup()
|
||||
{
|
||||
_enemiesInRoom = [];
|
||||
//_room.BodyEntered += Room_BodyEntered;
|
||||
//_room.BodyExited += Room_BodyExited;
|
||||
if (_room != null)
|
||||
{
|
||||
_room.BodyEntered += Room_BodyEntered;
|
||||
_room.BodyExited += Room_BodyExited;
|
||||
}
|
||||
}
|
||||
|
||||
private void Room_BodyExited(Node3D body)
|
||||
|
||||
10
Zennysoft.Game.Ma/src/map/dungeon/code/SpecialRoom.cs
Normal file
10
Zennysoft.Game.Ma/src/map/dungeon/code/SpecialRoom.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
using Chickensoft.AutoInject;
|
||||
using Chickensoft.Introspection;
|
||||
|
||||
namespace Zennysoft.Game.Ma;
|
||||
|
||||
[Meta(typeof(IAutoNode))]
|
||||
public partial class SpecialRoom : DungeonRoom
|
||||
{
|
||||
public override void _Notification(int what) => this.Notify(what);
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
uid://bccyfmj8ikewh
|
||||
@@ -1,4 +1,4 @@
|
||||
[gd_scene load_steps=101 format=4 uid="uid://bo20ffw2ygbks"]
|
||||
[gd_scene load_steps=97 format=4 uid="uid://bo20ffw2ygbks"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://xd6tx3lifebl" path="res://src/map/dungeon/code/SpecialFloor.cs" id="1_j4ho3"]
|
||||
[ext_resource type="Texture2D" uid="uid://ddrvsy7psmwig" path="res://src/map/dungeon/models/Special Floors & Rooms/35. Goddess of Guidance's Floor/GoG Room mirrored_DARKER_STONE_AREA_2.png" id="2_jbyuo"]
|
||||
@@ -15,10 +15,6 @@
|
||||
[ext_resource type="Texture2D" uid="uid://nvg6i8gbgqjv" path="res://src/map/dungeon/models/Special Floors & Rooms/35. Goddess of Guidance's Floor/GoG Room mirrored_angkor_mural.jpg" id="14_tf4w3"]
|
||||
[ext_resource type="Texture2D" uid="uid://3w1ac5fvks5v" path="res://src/map/dungeon/models/Special Floors & Rooms/35. Goddess of Guidance's Floor/GoG Room mirrored_area_2_big_tile.png" id="15_nduur"]
|
||||
[ext_resource type="Shader" uid="uid://beg8sp6kw66w8" path="res://src/map/map shaders/GOGROOM Water.gdshader" id="16_q4do2"]
|
||||
[ext_resource type="PackedScene" uid="uid://dbvr8ewajja6a" path="res://src/enemy/EnemyDatabase.tscn" id="17_j4ho3"]
|
||||
[ext_resource type="PackedScene" uid="uid://bs56ccgosmu47" path="res://src/enemy/enemy_types/01. sproingy/Sproingy.tscn" id="18_qt11j"]
|
||||
[ext_resource type="PackedScene" uid="uid://b0gwivt7cw7nd" path="res://src/enemy/enemy_types/02. michael/Michael.tscn" id="19_tkf4r"]
|
||||
[ext_resource type="PackedScene" uid="uid://cvk007twac22c" path="res://src/enemy/enemy_types/03. filth_eater/FilthEater.tscn" id="20_fs8fd"]
|
||||
|
||||
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_q1ixl"]
|
||||
resource_name = "Material.014"
|
||||
@@ -1078,8 +1074,3 @@ transform = Transform3D(230, 0, 0, 0, 230, 0, 0, 0, 230, 0, -4.49359, 0)
|
||||
mesh = SubResource("PlaneMesh_slalf")
|
||||
skeleton = NodePath("../Model/GoG Room mirrored")
|
||||
surface_material_override/0 = SubResource("ShaderMaterial_savej")
|
||||
|
||||
[node name="EnemyDatabase" parent="." instance=ExtResource("17_j4ho3")]
|
||||
unique_name_in_owner = true
|
||||
EnemyList = Array[PackedScene]([ExtResource("18_qt11j"), ExtResource("19_tkf4r"), ExtResource("20_fs8fd")])
|
||||
SpawnRate = PackedFloat32Array(0.5, 1, 1)
|
||||
|
||||
Reference in New Issue
Block a user