private void Initialize() { if (m_Initialized) { return; } m_Animator = GetComponent <Animator>(); m_Animator.updateMode = m_AnimatePhysics ? AnimatorUpdateMode.AnimatePhysics : AnimatorUpdateMode.Normal; m_Animator.cullingMode = m_CullingMode; m_Graph = PlayableGraph.Create(); m_Graph.SetTimeUpdateMode(DirectorUpdateMode.GameTime); SimpleAnimationPlayable template = new SimpleAnimationPlayable(); var playable = ScriptPlayable <SimpleAnimationPlayable> .Create(m_Graph, template, 1); m_Playable = playable.GetBehaviour(); m_Playable.onDone += OnPlayableDone; if (m_States == null) { m_States = new EditorState[1]; m_States[0] = new EditorState(); m_States[0].defaultState = true; m_States[0].name = "Default"; } if (m_States != null) { foreach (var state in m_States) { if (state.clip) { m_Playable.AddClip(state.clip, state.name); } } } EnsureDefaultStateExists(); AnimationPlayableUtilities.Play(m_Animator, m_Playable.playable, m_Graph); Play(); Kick(); m_Initialized = true; }
public override Playable CreateTrackMixer(PlayableGraph graph, GameObject go, int inputCount) { // before building, update the binding field in the clips assets; var director = go.GetComponent <PlayableDirector>(); var binding = director.GetGenericBinding(this); foreach (var c in GetClips()) { var myAsset = c.asset as MediaPlayerControlAsset; if (myAsset != null) { myAsset.binding = binding; } } //return base.CreateTrackMixer(graph, go, inputCount); return(ScriptPlayable <MediaPlayerControlMixerBehaviour> .Create(graph, inputCount)); }
public override Playable CreatePlayable(PlayableGraph graph, GameObject owner) { var playable = ScriptPlayable <RecorderPlayableBehaviour> .Create(graph); var behaviour = playable.GetBehaviour(); if (recorderType != null && UnityHelpers.IsPlaying()) { behaviour.session = new RecordingSession() { m_Recorder = RecordersInventory.GenerateNewRecorder(recorderType, m_Settings), m_RecorderGO = FrameRecorderGOControler.HookupRecorder(), m_RecordingStartTS = Time.time, m_FrameIndex = 0 }; } return(playable); }
void Start() { playableGraph = PlayableGraph.Create(); var playQueuePlayable = ScriptPlayable <PlayQueuePlayable> .Create(playableGraph); var playQueue = playQueuePlayable.GetBehaviour(); playQueue.Initialize(clipsToPlay, playQueuePlayable, playableGraph); var playableOutput = AnimationPlayableOutput.Create(playableGraph, "Animation", GetComponent <Animator>()); playableOutput.SetSourcePlayable(playQueuePlayable); playableOutput.SetSourceInputPort(0); playableGraph.Play(); }
public override Playable CreateTrackMixer( PlayableGraph graph, GameObject go, int inputCount) { foreach (var c in GetClips()) { CinemachineShot shot = (CinemachineShot)c.asset; CinemachineVirtualCameraBase vcam = shot.VirtualCamera.Resolve(graph.GetResolver()); if (vcam != null) { c.displayName = vcam.Name; } } var mixer = ScriptPlayable <CinemachineMixer> .Create(graph); mixer.SetInputCount(inputCount); return(mixer); }
public override Playable CreateTrackMixer(PlayableGraph graph, GameObject go, int inputCount) { PlayableDirector playableDirector = go.GetComponent <PlayableDirector>(); ScriptPlayable <VideoSchedulerPlayableBehaviour> playable = ScriptPlayable <VideoSchedulerPlayableBehaviour> .Create(graph, inputCount); VideoSchedulerPlayableBehaviour videoSchedulerPlayableBehaviour = playable.GetBehaviour(); if (videoSchedulerPlayableBehaviour != null) { videoSchedulerPlayableBehaviour.director = playableDirector; videoSchedulerPlayableBehaviour.clips = GetClips(); } return(playable); }
//---------------------------------------------------------------------------------------------------------------------- protected override Playable CreateTrackMixerInternal(PlayableGraph graph, GameObject go, int inputCount) { DeleteInvalidMarkers(); ScriptPlayable <RenderCachePlayableMixer> mixer = ScriptPlayable <RenderCachePlayableMixer> .Create(graph, inputCount); PlayableDirector director = go.GetComponent <PlayableDirector>(); m_trackMixer = mixer.GetBehaviour(); if (director != null) { Object boundObject = director.GetGenericBinding(this); BaseRenderCapturer capturer = boundObject as BaseRenderCapturer; m_trackMixer.Init(null == capturer ? null : capturer.gameObject, director, GetClips()); } return(mixer); }
public override Playable CreateTrackMixer(PlayableGraph graph, GameObject go, int inputCount) { var playable = ScriptPlayable <PathWalkerMixerBehaviour> .Create(graph, inputCount); //store the lane starting position in the clips to allow correct calculation of the paths //store start times to allow bullet/ship calculations past the clip's length Transform lane = go.GetComponent <PlayableDirector>().GetGenericBinding(this) as Transform; foreach (var clip in m_Clips) { var playableAsset = clip.asset as PathWalkerClip; playableAsset.lanePosition = lane.position; playableAsset.clipStart = clip.start; playableAsset.realDuration = clip.duration; } return(playable); }
//public ExposedReference<SteerClipParams> SteerParams; public override Playable CreatePlayable(PlayableGraph graph, GameObject owner) { //Debug.Log("PLAYABLE INIT"); var playable = ScriptPlayable <SteeringPlayable> .Create(graph); var dronePlayable = playable.GetBehaviour(); //var objectToMove = ObjectToMove.Resolve(playable.GetGraph().GetResolver()); var boid = Boid.Resolve(playable.GetGraph().GetResolver()); //var steerTo = SteerTo.Resolve(playable.GetGraph().GetResolver()); //var steerFrom = SteerFrom.Resolve(playable.GetGraph().GetResolver()); //var steerParams = SteerParams.Resolve(playable.GetGraph().GetResolver()); //dronePlayable.Initialize(boid, steerParams.startPos, steerParams.endPos, steerParams.depart, steerParams.arrive); dronePlayable.Initialize(boid, startPos, endPos, depart, arrive, master); return(playable); }
// Factory method that generates a playable based on this asset public override Playable CreatePlayable(PlayableGraph graph, GameObject go) { var playable = ScriptPlayable <LoopTimeline> .Create(graph); var b = playable.GetBehaviour(); //var pd = go.GetComponent<PlayableDirector>(); //#if UNITY_EDITOR // SetStartTime(pd); //#endif b.root = go; //b.setTime = startTime; return(playable); //return Playable.Create(graph); }
public override Playable CreateTrackMixer(PlayableGraph graph, GameObject go, int inputCount) { #if UNITY_EDITOR foreach (TimelineClip clip in m_Clips) { CameraEffectClip mouthClip = clip.asset as CameraEffectClip; // the template variable comes from classes made with the playable wizard CameraEffectBehaviour behaviour = mouthClip.template; mouthClip.camera = go.GetComponent <PlayableDirector>().GetGenericBinding(this) as Camera; // name the track with my variables value clip.displayName = mouthClip.EffectName; mouthClip.director = go.GetComponent <PlayableDirector>(); } #endif ScriptPlayable <CameraEffectMixerBehaviour> playable = ScriptPlayable <CameraEffectMixerBehaviour> .Create(graph, inputCount); return(playable); }
public override Playable CreateTrackMixer(PlayableGraph graph, GameObject go, int inputCount) { // Hack to set the display name of the clip foreach (var c in GetClips()) { var clip = (BlendShapeClip)c.asset; if (clip.BlendShape != null) { c.displayName = clip.BlendShape.SetName; } else { c.displayName = "no"; } } return(ScriptPlayable <BlendShapeMixerBehaviour> .Create(graph, inputCount)); }
// Factory method that generates a playable based on this asset public override Playable CreatePlayable(PlayableGraph graph, GameObject go) { var playable = ScriptPlayable <TimelineStateCtrlBehaviour> .Create(graph); playable.GetBehaviour().IsControllNewState = IsControllNewState; playable.GetBehaviour().IsControllInterruptState = IsControllInterruptState; playable.GetBehaviour().NewState = NewState; playable.GetBehaviour().InterruptState = InterruptState; var goe = go.GetComponent <GameObjectEntity>(); if (goe != null) { playable.GetBehaviour().Owner = goe.Entity; playable.GetBehaviour().EntityMgr = goe.EntityManager; } return(playable); }
protected override Playable CreateTrackMixerInternal(PlayableGraph graph, GameObject go, int inputCount) { ScriptPlayable <SceneCachePlayableMixer> playable = ScriptPlayable <SceneCachePlayableMixer> .Create(graph, inputCount); PlayableDirector director = go.GetComponent <PlayableDirector>(); m_trackMixer = playable.GetBehaviour(); if (null == director) { return(playable); } m_trackMixer.Init(director, this, GetClips()); return(playable); }
public override Playable CreateTrackMixer(PlayableGraph graph, GameObject go, int inputCount) { //Update clip displayName foreach (TimelineClip clip in GetClips()) { EventPlayerClip eventPlayerClip = clip.asset as EventPlayerClip; EventPlayer eventPlayer = eventPlayerClip.eventPlayer.Resolve(graph.GetResolver()); if (eventPlayer) { clip.displayName = eventPlayer.name; } else { clip.displayName = "(Null)"; } } return(ScriptPlayable <EventPlayerMixerBehaviour> .Create(graph, inputCount)); }
public override Playable CreatePlayable(PlayableGraph graph, GameObject owner) { var gos = new GameObject[] {}; if (!string.IsNullOrEmpty(m_targetBranchTag)) { gos = GameObject.FindGameObjectsWithTag(m_targetBranchTag); } var ret = ScriptPlayable <AlembicRecorderBehaviour> .Create(graph); var behaviour = ret.GetBehaviour(); behaviour.settings = m_settings; behaviour.ignoreFirstFrame = m_ignoreFirstFrame; m_settings.TargetBranch = gos.Length == 1 ? gos[0] : null; return(ret); }
//---------------------------------------------------------------------------------------------------------------------- protected override Playable CreateTrackMixerInternal(PlayableGraph graph, GameObject go, int inputCount) { InitTrackCurves(); var mixer = ScriptPlayable <StreamingImageSequencePlayableMixer> .Create(graph, inputCount); PlayableDirector director = go.GetComponent <PlayableDirector>(); m_trackMixer = mixer.GetBehaviour(); if (director != null) { Object boundObject = director.GetGenericBinding(this); StreamingImageSequenceRenderer renderer = boundObject as StreamingImageSequenceRenderer; m_trackMixer.Init(null == renderer ? null : renderer.gameObject, director, GetClips()); } return(mixer); }
public override Playable CreatePlayable(PlayableGraph graph, GameObject owner) { var playable = ScriptPlayable <CinemachineShotPlayable> .Create(graph); var behaviour = playable.GetBehaviour(); if (behaviour == null) { return(playable); } behaviour.VirtualCamera = VirtualCamera.Resolve(graph.GetResolver()); if (behaviour.VirtualCamera == null) { return(playable); } behaviour.LookAtBoneName = LookAtBoneName; behaviour.FollowBoneName = FollowBoneName; return(playable); }
public override Playable CreateTrackMixer(PlayableGraph graph, GameObject go, int inputCount) { var director = go.GetComponent <PlayableDirector>(); var trackTargetObject = director.GetGenericBinding(this) as GameObject; foreach (var clip in GetClips()) { var playableAsset = clip.asset as TimelineEventClip; if (playableAsset) { playableAsset.TrackTargetObject = trackTargetObject; } } var scriptPlayable = ScriptPlayable <TimelineEventMixerBehaviour> .Create(graph, inputCount); return(scriptPlayable); }
public static ScriptPlayable <ActivationControlPlayable> Create(PlayableGraph graph, GameObject gameObject, ActivationControlPlayable.PostPlaybackState postPlaybackState) { ScriptPlayable <ActivationControlPlayable> result; if (gameObject == null) { result = ScriptPlayable <ActivationControlPlayable> .get_Null(); } else { ScriptPlayable <ActivationControlPlayable> scriptPlayable = ScriptPlayable <ActivationControlPlayable> .Create(graph, 0); ActivationControlPlayable behaviour = scriptPlayable.GetBehaviour(); behaviour.gameObject = gameObject; behaviour.postPlayback = postPlaybackState; result = scriptPlayable; } return(result); }
public static Playable CreatePlayable( PlayableGraph graph, int le, int re, int m, float speed, FaceSetting[] seq) { var playable = ScriptPlayable <RoleFaceAnimBehaviour> .Create(graph); RoleFaceAnimBehaviour behaviour = playable.GetBehaviour(); behaviour.LeftEyeIndex = le; behaviour.RightEyeIndex = re; behaviour.MouthIndex = m; behaviour.faceSeq = seq; behaviour.speed = Mathf.Max(0.1f, speed); return(playable); }
public override Playable CreatePlayable(PlayableGraph graph, GameObject go) { ScriptPlayable <VideoPlayableBehaviour> playable = ScriptPlayable <VideoPlayableBehaviour> .Create(graph); VideoPlayableBehaviour playableBehaviour = playable.GetBehaviour(); playableBehaviour.videoClip = videoClip; playableBehaviour.mute = mute; playableBehaviour.loop = loop; playableBehaviour.preloadTime = preloadTime; playableBehaviour.startTime = startTime; playableBehaviour.endTime = endTime; playableBehaviour.image = image.Resolve(graph.GetResolver()); playableBehaviour.audioOutputMode = audioOutputMode; playableBehaviour.audioSource = audioSource.Resolve(graph.GetResolver()); return(playable); }
public virtual void Init() { if (_initialized) { return; } _animator = GetComponent <Animator>(); _graph = PlayableGraph.Create(); _graph.SetTimeUpdateMode(DirectorUpdateMode.GameTime); _graphConnected = false; AnimationPlayable template = new AnimationPlayable(); var playable = ScriptPlayable <AnimationPlayable> .Create(_graph, template, 1); _playable = playable.GetBehaviour(); _initialized = true; }
public override Playable CreateTrackMixer(PlayableGraph graph, GameObject go, int inputCount) { ScriptPlayable <PlayerCharacterTrackMixer> mixerScript = ScriptPlayable <PlayerCharacterTrackMixer> .Create(graph, inputCount); PlayerCharacterTrackMixer mixer = mixerScript.GetBehaviour(); mixer.Outro = Outro; foreach (TimelineClip clip in GetClips()) { PoseClip poseClip = clip.asset as PoseClip; if (poseClip != null) { poseClip.SetClip(clip); } } return(mixerScript); }
public override Playable CreatePlayable(PlayableGraph graph, GameObject owner) { var director = owner.GetComponent <PlayableDirector>(); var binding = director.GetGenericBinding(track); GameObject go = null; if (binding is Animator) { go = (binding as Animator).gameObject; } else if (binding is Animation) { go = (binding as Animation).gameObject; } AnchorBehaviour beha = new AnchorBehaviour(); beha.Set(clip_pos, clip_rot, go); return(ScriptPlayable <AnchorBehaviour> .Create(graph, beha)); }
public override Playable CreatePlayable(PlayableGraph graph, GameObject owner) { ScriptPlayable <SpineAnimatorPlayableBehaviour> playable = ScriptPlayable <SpineAnimatorPlayableBehaviour> .Create(graph, new SpineAnimatorPlayableBehaviour()); SpineAnimatorPlayableBehaviour clone = playable.GetBehaviour(); SpineAnimatorTrackMixer trackMixer = TimelineUtils.GetTrackMixer <SpineAnimatorTrackMixer>(graph, _parentAnimatorTrack); clone._clipAsset = this; if (trackMixer != null && trackMixer.GetTrackBinding() != null && !string.IsNullOrEmpty(_animationId)) { SkeletonAnimation skeletonAnimation = trackMixer.GetTrackBinding(); clone._animation = skeletonAnimation.skeletonDataAsset.GetAnimationStateData().SkeletonData.FindAnimation(_animationId); clone._animationSpeed = _animationSpeed; } return(playable); }
public void ForceInitialize() { _isInitialized = true; _animator = GetComponent <Animator>(); _playableGraph = PlayableGraph.Create(); _playableGraph.SetTimeUpdateMode(DirectorUpdateMode.GameTime); var template = new EasyAnimationPlayable(); var playable = ScriptPlayable <EasyAnimationPlayable> .Create(_playableGraph, template, 1); _playable = playable.GetBehaviour(); foreach (var animationClip in _animationClips) { _playable.Add(animationClip, animationClip.name); } foreach (var blendTree in _blendTrees) { _playable.Add(blendTree); } foreach (var blendTree in _blendTrees) { foreach (var blendMotion in blendTree.BlendMotions) { var animationClip = blendMotion.Motion as AnimationClip; if (!_animationClips.Contains(animationClip)) { _animationClips.Add(animationClip); } } } AnimationPlayableUtilities.Play(_animator, _playable.Self, _playableGraph); if (_playAutomaticallyOnInitialize) { _playable.Play(0); } }
public override Playable CreatePlayable(PlayableGraph graph, GameObject owner) { var playable = ScriptPlayable <TextBubbleBehaviour> .Create(graph); var behaviour = playable.GetBehaviour(); if (behaviour == null) { return(playable); } behaviour.bubbleData = bubbleData; behaviour.executer = BehaviourExecuterFactory.GetBubbleUIExecuter(behaviour); if (behaviour.executer == null) { return(playable); } behaviour.executer.OnPlayableCreate(playable); return(playable); }
public override Playable CreatePlayable(PlayableGraph graph, GameObject owner) { var playable = ScriptPlayable <MuscleTweenBehaviour> .Create(graph); playable.SetDuration(0.25); var behavior = playable.GetBehaviour(); behavior.EaseType = EaseType; behavior.UpdateStart = StartPose.Count == TargetPose.Count; for (int i = 0; i < TargetPose.Count; i++) { behavior.Pose.Add(new SavedMuscleInstance(TargetPose[i])); if (StartPose.HasIndex(i)) { behavior.Pose[i].Start = FindStartValue(TargetPose[i].MuscleIndex); } } return(playable); }
public override Playable CreatePlayable(PlayableGraph graph, GameObject owner) { #if UNITY_EDITOR if (!string.IsNullOrEmpty(eventName)) #else if (!cachedParameters && !string.IsNullOrEmpty(eventName)) #endif { FMOD.Studio.EventDescription eventDescription; RuntimeManager.StudioSystem.getEvent(eventName, out eventDescription); for (int i = 0; i < parameters.Length; i++) { FMOD.Studio.PARAMETER_DESCRIPTION parameterDescription; eventDescription.getParameterDescriptionByName(parameters[i].Name, out parameterDescription); parameters[i].ID = parameterDescription.id; } List <ParameterAutomationLink> parameterLinks = template.parameterLinks; for (int i = 0; i < parameterLinks.Count; i++) { FMOD.Studio.PARAMETER_DESCRIPTION parameterDescription; eventDescription.getParameterDescriptionByName(parameterLinks[i].Name, out parameterDescription); parameterLinks[i].ID = parameterDescription.id; } cachedParameters = true; } var playable = ScriptPlayable <FMODEventPlayableBehavior> .Create(graph, template); behavior = playable.GetBehaviour(); behavior.TrackTargetObject = TrackTargetObject; behavior.eventName = eventName; behavior.stopType = stopType; behavior.parameters = parameters; behavior.OwningClip = OwningClip; return(playable); }