https://unity3d.com/cn/learn/tutorials/projects/2d-game-kit/scenelinkedsmb
1.单个生命周期
image.png
public class SSS : SceneLinkedSMB<PlayerController>
{
/// <summary>
/// 动作刚进来
/// Called before Updates when execution of the state first starts (on transition to the state).
/// </summary>
public override void OnSLStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
{
base.OnSLStateEnter(animator, stateInfo, layerIndex);
m_MonoBehaviour.OnSLStateEnter("【1】");
}
/// <summary>
/// 还在完全转换到本动作过程中的Update
/// Called after OnSLStateEnter every frame during transition to the state.
/// </summary>
public override void OnSLTransitionToStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
{
base.OnSLTransitionToStateUpdate(animator, stateInfo, layerIndex);
m_MonoBehaviour.OnSLTransitionToStateUpdate("【1】");
}
/// <summary>
/// 完全转换到本状态的第一帧
/// Called on the first frame after the transition to the state has finished.
/// </summary>
public override void OnSLStatePostEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
{
base.OnSLStatePostEnter(animator, stateInfo, layerIndex);
m_MonoBehaviour.OnSLStatePostEnter("【1】");
}
/// <summary>
/// 完全转换到本状态后的Update
/// Called every frame after PostEnter when the state is not being transitioned to or from.
/// </summary>
public override void OnSLStateNoTransitionUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
{
base.OnSLStateNoTransitionUpdate(animator, stateInfo, layerIndex);
m_MonoBehaviour.OnSLStateNoTransitionUpdate("【1】");
}
/// <summary>
/// 开始转向下一个状态的第一帧
/// Called on the first frame after the transition from the state has started. Note that if the transition has a duration of less than a frame, this will not be called.
/// </summary>
public override void OnSLStatePreExit(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
{
base.OnSLStatePreExit(animator, stateInfo, layerIndex);
m_MonoBehaviour.OnSLStatePreExit("【1】");
}
/// <summary>
/// 转向下一个状态过程中的Update
/// Called after OnSLStatePreExit every frame during transition to the state.
/// </summary>
public override void OnSLTransitionFromStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
{
base.OnSLTransitionFromStateUpdate(animator, stateInfo, layerIndex);
m_MonoBehaviour.OnSLTransitionFromStateUpdate("【1】");
}
/// <summary>
/// 完全退出本状态
/// Called after Updates when execution of the state first finshes (after transition from the state).
/// </summary>
public override void OnSLStateExit(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
{
base.OnSLStateExit(animator, stateInfo, layerIndex);
m_MonoBehaviour.OnSLStateExit("【1】");
}
}
网友评论