35 lines
929 B
C#
35 lines
929 B
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 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);
|
|
}
|
|
|
|
public void OnReset()
|
|
{
|
|
_target = null;
|
|
_player = null;
|
|
}
|
|
}
|
|
}
|