mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-01 11:15:33 +00:00
37 lines
No EOL
861 B
C#
37 lines
No EOL
861 B
C#
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using Cirno.Scripts.Components.Actors;
|
|
using Godot;
|
|
|
|
public partial class ActorFreeMovement : MovementHandler
|
|
{
|
|
public override Vector2 FacingDirection
|
|
{
|
|
get => _parent.FacingDirection;
|
|
set => _parent.FacingDirection = value;
|
|
}
|
|
|
|
public override Vector2 MovementDirection
|
|
{
|
|
get => _parent.MovementDirection;
|
|
set => _parent.MovementDirection = value;
|
|
}
|
|
|
|
public override void Init(Actor parent)
|
|
{
|
|
base.Init(parent);
|
|
|
|
MovementDirection = Vector2.Zero;
|
|
FacingDirection = Vector2.Down;
|
|
}
|
|
|
|
public override void Move(double delta)
|
|
{
|
|
MovementDirection = AggregateInputProviders();
|
|
|
|
_parent.Velocity = MovementDirection * _parent.MovementSpeed;
|
|
|
|
_parent.MoveAndSlide();
|
|
}
|
|
|
|
} |