61 lines
1.2 KiB
C#
61 lines
1.2 KiB
C#
/*
|
||
* @Author: 白哉
|
||
* @Description:
|
||
* @Date: 2025年07月01日 星期二 14:07:05
|
||
* @Modify:
|
||
*/
|
||
|
||
|
||
using System;
|
||
using UnityEngine;
|
||
|
||
namespace TH1_Anim.Fragments
|
||
{
|
||
public enum FragmentState
|
||
{
|
||
Prepare,
|
||
Playing,
|
||
Finished,
|
||
Wrong
|
||
}
|
||
|
||
|
||
public abstract class FragmentBase
|
||
{
|
||
public FragmentState State;
|
||
public float StartTime;
|
||
public float Duration;
|
||
|
||
//当fragment被presentation驱动时,在结束时调用这个回调
|
||
public Action OnFinishedCallback;
|
||
|
||
|
||
public FragmentBase()
|
||
{
|
||
State = FragmentState.Prepare;
|
||
OnFinishedCallback = null;
|
||
}
|
||
|
||
public virtual void OnStart(float time)
|
||
{
|
||
StartTime = time;
|
||
}
|
||
|
||
public virtual void OnFinished()
|
||
{
|
||
}
|
||
|
||
public abstract void OnUpdate(float progressTime);
|
||
|
||
public abstract bool CheckDone(float progressTime);
|
||
|
||
public virtual bool TimeOut(float progressTime)
|
||
{
|
||
if (progressTime > Duration * 2)
|
||
{
|
||
Debug.Log($"Fragment TimeOut for type {this.GetType()}");
|
||
}
|
||
return progressTime > Duration * 2;
|
||
}
|
||
}
|
||
} |