using System; using UnityEngine; namespace Utility.CTween { public class CustomTweener { public AnimationCurve AnimationCurve = CustomTweenManager.AnimationCurveLibrary.Line; public Action OnCompleteAction; public Action OnUpdateAction; public Action OnUpdateAndValueAction; public Action OnDestroyAction; public float Duration; protected bool _isKilled; protected bool _isPause; protected bool _isComplete; protected bool _isPlaying; protected float _tempTimer; public bool IsLoop; public bool IsPlaying { get => _isPlaying; } protected float _curTime; /// /// 完成后是否自动销毁 /// public bool AutoDispose = true; public void Pause() { _isPlaying = false; _isPause = true; } public void Play() { _isPlaying = true; _isPause = false; } public void Start() { _isPause = true; } public virtual void Update() { } /// /// 被杀死后补间将会被回收 /// public async void Kill(bool isComplete = false) { if (_isKilled) { return; } if (isComplete) { OnCompleteAction?.Invoke(); } _isKilled = true; Dispose(); } public virtual void Dispose() { _tempTimer = 0; _curTime = 0; Duration = 0; _isPause = false; _isComplete = false; IsLoop = false; AutoDispose = true; OnCompleteAction = null; OnUpdateAction = null; OnUpdateAndValueAction = null; } } public delegate T CustomGetter(); public delegate void CustomSetter(T pNewValue); }