2025-10-23 20:33:44 +08:00

61 lines
1.2 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*
* @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;
}
}
}