Actor stub

This commit is contained in:
MaddoScientisto 2025-02-17 21:53:05 +01:00
commit a1bbe63b66
4 changed files with 73 additions and 1 deletions

View file

@ -0,0 +1,38 @@
using System.Collections.Generic;
using Cirno.Scripts;
using Godot;
public partial class Actor : CharacterBody2D
{
[Export]
public float MovementSpeed { get; private set; }
public Vector2 FacingDirection { get; set; }
private GameManager _gameManager;
private List<MovementHandler> _movementHandlers = new();
public override void _Ready()
{
_gameManager = this.GetGameManager();
var children = GetChildren();
foreach (var child in children) {
if (child is MovementHandler movementHandler)
{
_movementHandlers.Add(movementHandler);
}
}
}
public override void _PhysicsProcess(double delta)
{
foreach (var handler in _movementHandlers)
{
handler.Move(delta);
}
}
}