mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-08 23:45:55 +00:00
Bad tank movement
This commit is contained in:
parent
12f0062fe8
commit
90d2a95fa8
10 changed files with 514 additions and 8 deletions
|
|
@ -1,5 +1,6 @@
|
|||
using System.Collections.Generic;
|
||||
using Cirno.Scripts;
|
||||
using Cirno.Scripts.Components.Actors;
|
||||
using Godot;
|
||||
|
||||
public partial class Actor : CharacterBody2D
|
||||
|
|
@ -7,12 +8,15 @@ public partial class Actor : CharacterBody2D
|
|||
|
||||
[Export]
|
||||
public float MovementSpeed { get; private set; }
|
||||
|
||||
|
||||
public Vector2 MovementDirection { get; set; }
|
||||
public Vector2 FacingDirection { get; set; }
|
||||
|
||||
private GameManager _gameManager;
|
||||
|
||||
private List<MovementHandler> _movementHandlers = new();
|
||||
|
||||
private List<AnimationHandler> _animationHandlers = new();
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
|
|
@ -23,6 +27,12 @@ public partial class Actor : CharacterBody2D
|
|||
if (child is MovementHandler movementHandler)
|
||||
{
|
||||
_movementHandlers.Add(movementHandler);
|
||||
movementHandler.Init(this);
|
||||
}
|
||||
else if (child is AnimationHandler animationHandler)
|
||||
{
|
||||
_animationHandlers.Add(animationHandler);
|
||||
animationHandler.Init(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -33,6 +43,11 @@ public partial class Actor : CharacterBody2D
|
|||
{
|
||||
handler.Move(delta);
|
||||
}
|
||||
|
||||
foreach (var handler in _animationHandlers)
|
||||
{
|
||||
handler.Update(delta);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue