52 lines
1.2 KiB
C#
52 lines
1.2 KiB
C#
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using System.Globalization;
|
|
using BITKit.Entities;
|
|
using UnityEngine;
|
|
using UnityEngine.Playables;
|
|
|
|
namespace BITKit.Entities.Timeline
|
|
{
|
|
public class OverrideEntityBehaviour : PlayableBehaviour
|
|
{
|
|
private Entity entity;
|
|
|
|
[Inject] public IEntityOverride _entityOverride;
|
|
|
|
public override void OnBehaviourPlay(Playable playable, FrameData info)
|
|
{
|
|
if (BITAppForUnity.IsPlaying is false) return;
|
|
}
|
|
public override void ProcessFrame(Playable playable, FrameData info, object playerData)
|
|
{
|
|
if (BITAppForUnity.IsPlaying is false) return;
|
|
base.ProcessFrame(playable, info, playerData);
|
|
if (_entityOverride is null)
|
|
{
|
|
entity = playerData as Entity;
|
|
entity!.Inject(this);
|
|
}
|
|
if (info.weight is 0)
|
|
{
|
|
_entityOverride?.RemoveOverride(this);
|
|
}
|
|
else
|
|
{
|
|
_entityOverride?.AddOverride(this);
|
|
}
|
|
}
|
|
public override void OnBehaviourPause(Playable playable, FrameData info)
|
|
{
|
|
}
|
|
public override void OnPlayableCreate(Playable playable)
|
|
{
|
|
|
|
}
|
|
public override void OnPlayableDestroy(Playable playable)
|
|
{
|
|
if (BITAppForUnity.IsPlaying is false) return;
|
|
_entityOverride?.RemoveOverride(this);
|
|
}
|
|
}
|
|
} |