2024-12-01 17:07:41 +00:00
|
|
|
using Godot;
|
|
|
|
using System.Collections;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using Godot.Collections;
|
|
|
|
|
|
|
|
namespace Rokojori
|
|
|
|
{
|
|
|
|
[GlobalClass]
|
|
|
|
public partial class CharacterControllerAction:RJAction
|
|
|
|
{
|
|
|
|
[Export]
|
|
|
|
public CharacterController controller;
|
|
|
|
|
|
|
|
public CharacterBody3D body => controller.body;
|
|
|
|
|
2025-01-03 12:09:23 +00:00
|
|
|
public void AddVelocity( Vector3 velocity )
|
|
|
|
{
|
|
|
|
body.Velocity += velocity * controller.delta;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void SetVelocity( Vector3 velocity )
|
|
|
|
{
|
|
|
|
body.Velocity = velocity * controller.delta;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void Velocity( Vector3 velocity, bool replace )
|
2024-12-01 17:07:41 +00:00
|
|
|
{
|
|
|
|
if ( replace )
|
|
|
|
{
|
2025-01-03 12:09:23 +00:00
|
|
|
SetVelocity( velocity );
|
2024-12-01 17:07:41 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2025-01-03 12:09:23 +00:00
|
|
|
AddVelocity( velocity );
|
2024-12-01 17:07:41 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|