mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-21 23:34:06 +00:00
Actor stub
This commit is contained in:
parent
237a59055b
commit
a1bbe63b66
4 changed files with 73 additions and 1 deletions
38
Scripts/Components/Actors/Actor.cs
Normal file
38
Scripts/Components/Actors/Actor.cs
Normal 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);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue