Improvements to save and loading

Improvements to Chinthe animation logic
Fix broken Godot Tool system and just use a more manual approach to setting map nodes
Remove ItemDatabase from individual room scenes
This commit is contained in:
2025-10-24 01:33:18 -07:00
parent f5360adbf1
commit 286c221530
93 changed files with 497 additions and 678 deletions

View File

@@ -2,7 +2,6 @@
using Chickensoft.Introspection;
using Godot;
using System;
using System.Linq;
namespace Zennysoft.Game.Ma;
@@ -16,6 +15,10 @@ public abstract partial class EnemyModelView : Node3D, IEnemyModelView
private readonly string _primaryAttackName = "Primary Attack";
private readonly string _secondaryAttackName = "Secondary Attack";
private readonly string _activateName = "Activate";
private readonly string _activateFront = "activate";
private readonly string _activateLeft = "activate_left";
private readonly string _activateRight = "activate_right";
private readonly string _activateBack = "activate_back";
private readonly string _parametersPlayback = "parameters/playback";
[Node] public AnimationTree AnimationTree { get; set; } = default!;
@@ -26,9 +29,15 @@ public abstract partial class EnemyModelView : Node3D, IEnemyModelView
public event EventHandler HitPlayer;
public event EventHandler ActivationFinished;
[Export]
public bool CanMove { get; set; } = false;
public void OnReady()
{
_stateMachine = (AnimationNodeStateMachinePlayback)AnimationTree.Get(_parametersPlayback);
AnimationTree.AnimationFinished += AnimationTree_AnimationFinished;
}
public virtual void PlayPrimaryAttackAnimation() => _stateMachine.Travel(_primaryAttackName);
@@ -49,6 +58,13 @@ public abstract partial class EnemyModelView : Node3D, IEnemyModelView
protected virtual void OnPlayerHit(AttackEventArgs arg) => HitPlayer?.Invoke(this, arg);
private void AnimationTree_AnimationFinished(StringName animName)
{
if (animName == _activateFront || animName == _activateLeft || animName == _activateRight || animName == _activateBack)
ActivationFinished?.Invoke(this, EventArgs.Empty);
}
public override void _ExitTree()
{
AnimationTree.Get(_parametersPlayback).As<AnimationNodeStateMachinePlayback>().Stop();