You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
72 lines
1.9 KiB
72 lines
1.9 KiB
using AOT;
|
|
using GAS.Runtime;
|
|
using Sog;
|
|
|
|
namespace CoreGame.Render
|
|
{
|
|
public sealed class GABeBeatenBack : GameplayAbility
|
|
{
|
|
public GABeBeatenBack(IAbilityData abilityAsset)
|
|
{
|
|
|
|
}
|
|
|
|
public override AbilitySpec CreateSpec(AbilitySystemComponent owner, GameAbilityContext ctx)
|
|
{
|
|
var beBeatenBackSpec = SptPool<GABeBeatenBackSpec>.Malloc();
|
|
beBeatenBackSpec.Awake(this, ctx);
|
|
return beBeatenBackSpec;
|
|
}
|
|
|
|
public override void FreeSpec(ref AbilitySpec spec)
|
|
{
|
|
if (spec is not GABeBeatenBackSpec beBeatenBackSpec)
|
|
{
|
|
BattleLogger.LogInfo("BeBeatenBackAbilitySpec.FreeSpec: spec is not BeBeatenBackAbilitySpec");
|
|
return;
|
|
}
|
|
SptPool<GABeBeatenBackSpec>.Free(ref beBeatenBackSpec);
|
|
}
|
|
}
|
|
|
|
|
|
public sealed class GABeBeatenBackSpec : AbilitySpec, ISptPool
|
|
{
|
|
private Fixed64 m_TimeAcc;
|
|
private Fixed64 m_TotalTime;
|
|
private Fixed64Vector2 m_Offset;
|
|
|
|
public override void ActivateAbility()
|
|
{
|
|
m_TimeAcc = 0f;
|
|
m_Offset = new Fixed64Vector2(gaParams.param2.floatVal, gaParams.param3.floatVal);
|
|
m_TotalTime = gaParams.param4.floatVal;
|
|
}
|
|
|
|
protected override void AbilityTick(Fixed64 dt)
|
|
{
|
|
if (m_TimeAcc >= m_TotalTime ||
|
|
!ForceMoveSrv.ForceMoveEntity(ctx.ownerEnt, dt / m_TotalTime * m_Offset, false))
|
|
{
|
|
TryEndAbility();
|
|
}
|
|
m_TimeAcc += dt;
|
|
}
|
|
|
|
|
|
public override void CancelAbility()
|
|
{
|
|
}
|
|
|
|
public override void EndAbility()
|
|
{
|
|
}
|
|
|
|
public void Reset()
|
|
{
|
|
m_TotalTime = 0;
|
|
m_TimeAcc = 0;
|
|
m_Offset = Fixed64Vector2.zero;
|
|
}
|
|
}
|
|
}
|