public override Playable CreatePlayable(PlayableGraph graph, GameObject owner) { var playable = ScriptPlayable <AmPlayableBehaviour> .Create(graph, template); AmPlayableBehaviour clone = playable.GetBehaviour(); //am.exposedName = GetInstanceID().ToString(); clone.am = am.Resolve(graph.GetResolver()); return(playable); }
internal void PullLever(ActorManager attack, ActorManager victim) { pd.playableAsset = Instantiate(pullLever); TimelineAsset timeline = (TimelineAsset)pd.playableAsset; foreach (var track in timeline.GetOutputTracks()) { if (track.name == "Player Script") { pd.SetGenericBinding(track, attack); foreach (var clip in track.GetClips()) { AmPlayableClip amClip = (AmPlayableClip)clip.asset; AmPlayableBehaviour amBehaviour = amClip.template; amClip.am.exposedName = System.Guid.NewGuid().ToString(); pd.SetReferenceValue(amClip.am.exposedName, attack); } } else if (track.name == "Lever Script") { pd.SetGenericBinding(track, victim); foreach (var clip in track.GetClips()) { AmPlayableClip amClip = (AmPlayableClip)clip.asset; AmPlayableBehaviour amBehaviour = amClip.template; amClip.am.exposedName = System.Guid.NewGuid().ToString(); pd.SetReferenceValue(amClip.am.exposedName, victim); } } else if (track.name == "Player Animation") { pd.SetGenericBinding(track, attack.ac.anim); } else if (track.name == "Lever Animation") { pd.SetGenericBinding(track, victim.ac.anim); } } pd.Evaluate(); pd.Play(); }
// NOTE: This function is called at runtime and edit time. Keep that in mind when setting the values of properties. public override void ProcessFrame(Playable playable, FrameData info, object playerData) { ActorManager trackBinding = playerData as ActorManager; if (!trackBinding) { return; } int inputCount = playable.GetInputCount(); for (int i = 0; i < inputCount; i++) { float inputWeight = playable.GetInputWeight(i); ScriptPlayable <AmPlayableBehaviour> inputPlayable = (ScriptPlayable <AmPlayableBehaviour>)playable.GetInput(i); AmPlayableBehaviour input = inputPlayable.GetBehaviour(); // Use the above variables to process each frame of this playable. } }