41 lines
1.4 KiB
C#
41 lines
1.4 KiB
C#
using SepCore.Entity;
|
|
using UnityEngine;
|
|
|
|
namespace SepCore.Components
|
|
{
|
|
public class AbsorbComponent : MonoBehaviour
|
|
{
|
|
private Player _player;
|
|
private Transform _target;
|
|
|
|
public float AbsorbRange => GameEntry.Luban.Global.DefaultAbsorbRange;
|
|
public float AbsorbSpeed => GameEntry.Luban.Global.AbsorbSpeed;
|
|
public float CollectDistance => GameEntry.Luban.Global.CollectDistance;
|
|
public float RecoilDistance => GameEntry.Luban.Global.RecoilDistance;
|
|
public float RecoilDuration => GameEntry.Luban.Global.RecoilDuration;
|
|
public float DashAccelerationDuration => GameEntry.Luban.Global.DashAccelerationDuration;
|
|
public float DashMaxSpeedMultiplier => GameEntry.Luban.Global.DashMaxSpeedMultiplier;
|
|
public float TurnSpeed => GameEntry.Luban.Global.TurnSpeed;
|
|
|
|
public void OnInit(Player player)
|
|
{
|
|
_player = player;
|
|
_target = player.CachedTransform;
|
|
}
|
|
|
|
public void OnUpdate(float elapseSeconds, float realElapseSeconds)
|
|
{
|
|
if (!_player.Available) return;
|
|
|
|
GameEntry.SimulationWorld.SyncPlayerAbsorbSettings(AbsorbRange, AbsorbSpeed, CollectDistance,
|
|
RecoilDistance, RecoilDuration, DashAccelerationDuration, DashMaxSpeedMultiplier, TurnSpeed);
|
|
}
|
|
|
|
public void OnReset()
|
|
{
|
|
_target = null;
|
|
_player = null;
|
|
}
|
|
}
|
|
}
|