1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798 |
- using System;
- using UnityEngine;
- namespace Utility.CTween
- {
- public class CustomTweener
- {
- public AnimationCurve AnimationCurve = CustomTweenManager.AnimationCurveLibrary.Line;
- public Action OnCompleteAction;
- public Action OnUpdateAction;
- public Action<object> 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;
- /// <summary>
- /// 完成后是否自动销毁
- /// </summary>
- 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()
- {
- }
- /// <summary>
- /// 被杀死后补间将会被回收
- /// </summary>
- 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<out T>();
- public delegate void CustomSetter<in T>(T pNewValue);
- }
|