42 lines
1.1 KiB
C#
42 lines
1.1 KiB
C#
|
using System.Collections.Generic;
|
|||
|
using UnityEngine;
|
|||
|
using UnityEngine.Playables;
|
|||
|
using UnityEngine.Timeline;
|
|||
|
|
|||
|
namespace Thousandto.Launcher.ExternalLibs
|
|||
|
{
|
|||
|
/// <summary>
|
|||
|
/// 触发消息的Track
|
|||
|
/// </summary>
|
|||
|
public class PushEventMixBehaviour : PlayableBehaviour
|
|||
|
{
|
|||
|
|
|||
|
public override void ProcessFrame(Playable playable, FrameData info, object playerData)
|
|||
|
{
|
|||
|
var go = playerData as GameObject;
|
|||
|
if (go == null)
|
|||
|
{
|
|||
|
return;
|
|||
|
}
|
|||
|
|
|||
|
for (int i = 0; i < playable.GetInputCount(); i++)
|
|||
|
{
|
|||
|
var inputPlayable = (ScriptPlayable<PushEventBehaviour>)playable.GetInput(i);
|
|||
|
var inputBehaviour = inputPlayable.GetBehaviour();
|
|||
|
if (inputBehaviour != null)
|
|||
|
{
|
|||
|
if (playable.GetInputWeight(i) > 0)
|
|||
|
{
|
|||
|
inputBehaviour.DoTrigger(go);
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
|
|||
|
inputBehaviour.Reset();
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|