timeline clip 自由转向
parent
62fe3b3b87
commit
418b3029d3
@ -0,0 +1,22 @@
|
|||||||
|
namespace Game
|
||||||
|
{
|
||||||
|
public class ClipInputControl : TimelineClipBase
|
||||||
|
{
|
||||||
|
private InputControlClip _mRealAsset;
|
||||||
|
|
||||||
|
public override void OnEnter()
|
||||||
|
{
|
||||||
|
_mRealAsset = Asset as InputControlClip;
|
||||||
|
Owner.move.IsFreeTurn = _mRealAsset.template.IsFreeTurn;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void OnStay()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void OnLeave()
|
||||||
|
{
|
||||||
|
Owner.move.IsFreeTurn = !_mRealAsset.template.IsFreeTurn;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,3 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 859eb3221c13438eb6b3ae1ca0f32c68
|
||||||
|
timeCreated: 1686836094
|
||||||
@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 51143b6b71daf464db8991252d57247f
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@ -0,0 +1,14 @@
|
|||||||
|
using System;
|
||||||
|
using UnityEngine;
|
||||||
|
using UnityEngine.Playables;
|
||||||
|
using UnityEngine.Timeline;
|
||||||
|
|
||||||
|
[Serializable]
|
||||||
|
public class InputControlBehaviour : PlayableBehaviour
|
||||||
|
{
|
||||||
|
[Rename("受否自由转向")] public bool IsFreeTurn;
|
||||||
|
|
||||||
|
public override void OnPlayableCreate(Playable playable)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 838c2439f8663114995bda1c0f8d8bae
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@ -0,0 +1,22 @@
|
|||||||
|
using System;
|
||||||
|
using UnityEngine;
|
||||||
|
using UnityEngine.Playables;
|
||||||
|
using UnityEngine.Timeline;
|
||||||
|
|
||||||
|
[Serializable]
|
||||||
|
public class InputControlClip : PlayableAsset, ITimelineClipAsset
|
||||||
|
{
|
||||||
|
public InputControlBehaviour template = new InputControlBehaviour ();
|
||||||
|
|
||||||
|
public ClipCaps clipCaps
|
||||||
|
{
|
||||||
|
get { return ClipCaps.None; }
|
||||||
|
}
|
||||||
|
|
||||||
|
public override Playable CreatePlayable (PlayableGraph graph, GameObject owner)
|
||||||
|
{
|
||||||
|
var playable = ScriptPlayable<InputControlBehaviour>.Create (graph, template);
|
||||||
|
InputControlBehaviour clone = playable.GetBehaviour ();
|
||||||
|
return playable;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: cf3a0ded57877e4408206f1ebe220ada
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@ -0,0 +1,23 @@
|
|||||||
|
using System;
|
||||||
|
using UnityEngine;
|
||||||
|
using UnityEngine.Playables;
|
||||||
|
using UnityEngine.Timeline;
|
||||||
|
|
||||||
|
public class InputControlMixerBehaviour : PlayableBehaviour
|
||||||
|
{
|
||||||
|
// 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)
|
||||||
|
{
|
||||||
|
int inputCount = playable.GetInputCount ();
|
||||||
|
|
||||||
|
for (int i = 0; i < inputCount; i++)
|
||||||
|
{
|
||||||
|
float inputWeight = playable.GetInputWeight(i);
|
||||||
|
ScriptPlayable<InputControlBehaviour> inputPlayable = (ScriptPlayable<InputControlBehaviour>)playable.GetInput(i);
|
||||||
|
InputControlBehaviour input = inputPlayable.GetBehaviour ();
|
||||||
|
|
||||||
|
// Use the above variables to process each frame of this playable.
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: b953d6e8b7295ea44ad73543757b04c4
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@ -0,0 +1,13 @@
|
|||||||
|
using UnityEngine;
|
||||||
|
using UnityEngine.Playables;
|
||||||
|
using UnityEngine.Timeline;
|
||||||
|
|
||||||
|
[TrackColor(0.855f, 0.8623f, 0.87f)]
|
||||||
|
[TrackClipType(typeof(InputControlClip))]
|
||||||
|
public class InputControlTrack : TrackAsset
|
||||||
|
{
|
||||||
|
public override Playable CreateTrackMixer(PlayableGraph graph, GameObject go, int inputCount)
|
||||||
|
{
|
||||||
|
return ScriptPlayable<InputControlMixerBehaviour>.Create (graph, inputCount);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,11 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: c0af86dcc0103db4eada768bc0a1fa8e
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 0
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
Loading…
Reference in New Issue