public override Playable CreatePlayable(PlayableGraph graph, GameObject owner) { var director = graph.GetResolver() as PlayableDirector; foreach (var playableAssetOutput in director.playableAsset.outputs) { if (playableAssetOutput.outputTargetType == typeof(RoleInfo)) { role = (RoleInfo)director.GetGenericBinding(playableAssetOutput.sourceObject); } } var playable = ScriptPlayable <RoleAnimationBehaviour> .Create(graph, template); var clone = playable.GetBehaviour(); clone.type = type; clone.role = role; return(playable); }
public override Playable CreateTrackMixer(PlayableGraph graph, GameObject go, int inputCount) { var playable = ScriptPlayable <PointCloudMixerBehaviour> .Create(graph, inputCount); PointCloudMixerBehaviour clone = playable.GetBehaviour(); //connect first marching cubes manager that is found in the scene DensityFieldManager[] managers = FindObjectsOfType(typeof(DensityFieldManager)) as DensityFieldManager[]; if (managers.Length > 0) { MarchingCubesManagerRef.defaultValue = managers[0]; } clone.DFMRef_ = MarchingCubesManagerRef.Resolve(graph.GetResolver()); clone.RegisterTrack(); return(playable); }
public void initializeBehaviour(PlayableGraph graph, AkEventPlayableBehavior b, GameObject owner) { b.akEvent = akEvent; b.eventTracker = eventTracker; b.easeInDuration = easeInDuration; b.easeOutDuration = easeOutDuration; b.blendInDuration = blendInDuration; b.blendOutDuration = blendOutDuration; b.eventShouldRetrigger = retriggerEvent; b.overrideTrackEmittorObject = overrideTrackEmitterObject; if (overrideTrackEmitterObject) { b.eventObject = emitterObjectRef.Resolve(graph.GetResolver()); } else { b.eventObject = owner; } }
#pragma warning disable CS0115 // 'CinemachineTrack.CreateTrackMixer(PlayableGraph, GameObject, int)': no suitable method found to override public override Playable CreateTrackMixer( #pragma warning restore CS0115 // 'CinemachineTrack.CreateTrackMixer(PlayableGraph, GameObject, int)': no suitable method found to override PlayableGraph graph, GameObject go, int inputCount) { // Hack to set the display name of the clip to match the vcam 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 CreatePlayable(PlayableGraph graph, GameObject gameObject) { var behaviour = new iTweenPlayableBehaviour(); { behaviour.target = target.Resolve(graph.GetResolver());; behaviour.action = iTweenEvent.GetMethod(hash.type); behaviour.hash = hash.ToHashtable(); } if (overwritableFromPlayableAsset) { float delay = behaviour.hash.ContainsKey("delay") ? (float)behaviour.hash["delay"] : 0f; behaviour.hash["time"] = this.duration - delay; } var playable = ScriptPlayable <iTweenPlayableBehaviour> .Create(graph, behaviour); return(playable); }
public override Playable CreatePlayable(PlayableGraph graph, GameObject owner) { var playable = ScriptPlayable <PointCloudBehaviour> .Create(graph, template); PointCloudBehaviour clone = playable.GetBehaviour(); //connect first marching cubes manager that is found in the scene DensityFieldManager[] managers = FindObjectsOfType(typeof(DensityFieldManager)) as DensityFieldManager[]; if (managers.Length > 0) { MarchingCubesManagerRef.defaultValue = managers[0]; } clone.MarchingCubesManagerRef = MarchingCubesManagerRef.Resolve(graph.GetResolver()); clone.RegisterPointCloudClip(); return(playable); }
/// <summary> /// TrackAsset implementation /// </summary> /// <param name="graph"></param> /// <param name="go"></param> /// <param name="inputCount"></param> /// <returns></returns> public override Playable CreateTrackMixer( PlayableGraph graph, GameObject go, int inputCount) { #if !UNITY_2019_2_OR_NEWER // Hack to set the display name of the clip to match the vcam foreach (var c in GetClips()) { CinemachineShot shot = (CinemachineShot)c.asset; CinemachineVirtualCameraBase vcam = shot.VirtualCamera.Resolve(graph.GetResolver()); if (vcam != null) { c.displayName = vcam.Name; } } #endif var mixer = ScriptPlayable <CinemachineMixer> .Create(graph); mixer.SetInputCount(inputCount); return(mixer); }
public override Playable CreateTrackMixer(PlayableGraph graph, GameObject go, int inputCount) { foreach (var clip in GetClips()) { var myAsset = clip.asset as TimelineAnimatorClip; if (myAsset) { myAsset.template.duration = (float)clip.duration; myAsset.template.start = clip.start; myAsset.template.end = clip.end; } GameObject obj = myAsset.target.Resolve(graph.GetResolver()); if (obj != null) { clip.displayName = obj.name; //update name based on target object } } return(ScriptPlayable <TimelineAnimatorMixerBehaviour> .Create(graph, inputCount)); }
public override Playable CreatePlayable(PlayableGraph graph, GameObject owner) { var playable = ScriptPlayable <VMOperateBehaviour> .Create(graph); var behaviour = playable.GetBehaviour(); if (behaviour == null) { return(playable); } behaviour.cinemachineCamera = cinemachineCamera; behaviour.roleData = roleData.Resolve(graph.GetResolver()); behaviour.priority = priority; behaviour.operateType = operateType; behaviour.executer = BehaviourExecuterFactory.GetVMOperateExecuter(behaviour); if (behaviour.executer == null) { return(playable); } behaviour.executer.OnPlayableCreate(playable); return(playable); }
public override Playable CreatePlayable(PlayableGraph graph, GameObject owner) { GameObject sourceObject = sourceGameObject.Resolve(graph.GetResolver()); var playable = ScriptPlayable <PositionLockBehaviour> .Create(graph, template); if (sourceObject != null) { playable.GetBehaviour().sourceTransform = sourceObject.transform; } #if UNITY_EDITOR if (sourceObject != null) { ApplyClipDisplayName(sourceObject.name); } else { ApplyClipDisplayName("None"); } #endif return(playable); }
public override Playable CreatePlayable(PlayableGraph graph, GameObject go) { T resolvedInvokeTarget = invokeTarget.Resolve(graph.GetResolver()); if (resolvedInvokeTarget != null) { InvokerPlayableBehaviour invoker = new InvokerPlayableBehaviour(); Action action; if (MethodPairings(resolvedInvokeTarget).TryGetValue(selectedMethod, out action)) { invoker.InvokeOnPlay = action; invoker.EnumName = selectedMethod.ToString(); //Debug.Log("Creating Playable " + selectedMethod.ToString()); return(ScriptPlayable <InvokerPlayableBehaviour> .Create(graph, invoker)); } else { Debug.LogError($"The enum {selectedMethod} is not paired with any delegate."); } } //Debug.LogWarning("Cannot resolve the exposed reference."); return(Playable.Create(graph)); }
public override Playable CreatePlayable(PlayableGraph graph, GameObject owner) { var playable = ScriptPlayable <KaiTool_PlayableBehaviour> .Create(graph); var listener = m_eventListener.Resolve(graph.GetResolver()); playable.GetBehaviour().m_behaviourPlayEventHandle += (sender, e) => { if (listener) { var args = new Listener_EventArgs(); args.m_playable = e.m_playable; args.m_info = e.m_info; listener.OnBehaviourPlay(args); } }; playable.GetBehaviour().m_behaviourPauseEventHandle += (sender, e) => { // var listener = m_eventListener.Resolve(graph.GetResolver()); if (listener != null) { var args = new Listener_EventArgs(); args.m_playable = e.m_playable; args.m_info = e.m_info; listener.OnBehaviourPause(args); } }; playable.GetBehaviour().m_graphStartEventHandle += (sender, e) => { // var listener = m_eventListener.Resolve(graph.GetResolver()); if (listener) { var args = new Listener_EventArgs(); args.m_playable = e.m_playable; args.m_info = e.m_info; listener.OnGraphStart(args); } }; playable.GetBehaviour().m_graphStopEventHandle += (sender, e) => { //var listener = m_eventListener.Resolve(graph.GetResolver()); if (listener) { var args = new Listener_EventArgs(); args.m_playable = e.m_playable; args.m_info = e.m_info; listener.OnGraphStop(args); } }; playable.GetBehaviour().m_prepareFrameEventHandle += (sender, e) => { // var listener = m_eventListener.Resolve(graph.GetResolver()); if (listener) { var args = new Listener_EventArgs(); args.m_playable = e.m_playable; args.m_info = e.m_info; listener.OnPrepareFrame(args); } }; return(playable); }
// Token: 0x060001A3 RID: 419 RVA: 0x00008660 File Offset: 0x00006860 public override Playable CreatePlayable(PlayableGraph graph, GameObject go) { if (this.prefabGameObject != null) { if (s_CreatedPrefabs.Contains(this.prefabGameObject)) { Debug.LogWarningFormat("Control Track Clip ({0}) is causing a prefab to instantiate itself recursively. Aborting further instances.", new object[] { base.name }); return(Playable.Create(graph, 0)); } s_CreatedPrefabs.Add(this.prefabGameObject); } Playable playable = Playable.Null; List <Playable> list = new List <Playable>(); GameObject endGo = this.sourceGameObject.Resolve(graph.GetResolver()); GameObject startGo = this.startGameObject.Resolve(graph.GetResolver()); //#if UNITY_EDITOR // //得到TimelinClip,拿到时长 // var director = go.GetComponent<PlayableDirector>(); // var tlAsset = director.playableAsset as TimelineAsset; // foreach (var track in tlAsset.GetOutputTracks()) // { // foreach (var clip in track.GetClips()) // { // if (clip.asset == this) // { // this.m_Duration = clip.duration; // break; // } // } // } //#endif if (this.prefabGameObject != null) { Transform endTrans = (!(endGo != null)) ? null : endGo.transform; Transform startTrans = (!(startGo != null)) ? null : startGo.transform; ScriptPlayable <FlyParticlePrefabControl> playable2 = FlyParticlePrefabControl.Create( graph, this.prefabGameObject, startTrans, endTrans, startPosOffset, posOffset, followType, initResetRotate , this.realLife, flyDuration, revert, scaleFactor ); endGo = playable2.GetBehaviour().prefabInstance; list.Add(playable2); } //this.m_Duration = PlayableBinding.DefaultDuration; this.m_SupportLoop = false; if (endGo != null) { IList <ParticleSystem> particleSystems = ((!this.updateParticle) || (realLife > 0f && Application.isPlaying))? k_EmptyParticlesList:this.GetParticleSystemRoots(endGo); PlayableDirector component = go.GetComponent <PlayableDirector>(); if (component != null) { this.m_ControlDirectorAsset = component.playableAsset; } if (go == endGo && this.prefabGameObject == null) { Debug.LogWarningFormat("Control Playable ({0}) is referencing the same PlayableDirector component than the one in which it is playing.", new object[] { base.name }); this.active = false; } if (this.active && realLife < 0.01f) { this.CreateActivationPlayable(endGo, graph, list); } if (this.updateParticle) { this.SearchHiearchyAndConnectParticleSystem(particleSystems, graph, list); } playable = ConnectPlayablesToMixer(graph, list); } if (this.prefabGameObject != null) { s_CreatedPrefabs.Remove(this.prefabGameObject); } if (!playable.IsValid <Playable>()) { playable = Playable.Create(graph, 0); } 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 GameObject GetExportRoot(PlayableGraph graph) { return(m_exportRoot.Resolve(graph.GetResolver())); }
/// <summary> /// Creates the root of a Playable subgraph to control the contents of the game object. /// </summary> /// <param name="graph">PlayableGraph that will own the playable</param> /// <param name="go">The GameObject that triggered the graph build</param> /// <returns>The root playable of the subgraph</returns> public override Playable CreatePlayable(PlayableGraph graph, GameObject go) { // case 989856 if (prefabGameObject != null) { if (s_CreatedPrefabs.Contains(prefabGameObject)) { Debug.LogWarningFormat("Control Track Clip ({0}) is causing a prefab to instantiate itself recursively. Aborting further instances.", name); return(Playable.Create(graph)); } s_CreatedPrefabs.Add(prefabGameObject); } Playable root = Playable.Null; var playables = new List <Playable>(); GameObject sourceObject = sourceGameObject.Resolve(graph.GetResolver()); if (prefabGameObject != null) { Transform parenTransform = sourceObject != null ? sourceObject.transform : null; var controlPlayable = PrefabControlPlayable.Create(graph, prefabGameObject, parenTransform); sourceObject = controlPlayable.GetBehaviour().prefabInstance; playables.Add(controlPlayable); } m_Duration = PlayableBinding.DefaultDuration; m_SupportLoop = false; if (sourceObject != null) { var directors = updateDirector ? GetComponent <PlayableDirector>(sourceObject) : k_EmptyDirectorsList; var particleSystems = updateParticle ? GetParticleSystemRoots(sourceObject) : k_EmptyParticlesList; // update the duration and loop values (used for UI purposes) here // so they are tied to the latest gameObject bound UpdateDurationAndLoopFlag(directors, particleSystems); var director = go.GetComponent <PlayableDirector>(); if (director != null) { m_ControlDirectorAsset = director.playableAsset; } if (go == sourceObject && prefabGameObject == null) { Debug.LogWarningFormat("Control Playable ({0}) is referencing the same PlayableDirector component than the one in which it is playing.", name); active = false; if (!searchHierarchy) { updateDirector = false; } } if (active) { CreateActivationPlayable(sourceObject, graph, playables); } if (updateDirector) { SearchHierarchyAndConnectDirector(directors, graph, playables, prefabGameObject != null); } if (updateParticle) { SearchHiearchyAndConnectParticleSystem(particleSystems, graph, playables); } if (updateITimeControl) { SearchHierarchyAndConnectControlableScripts(GetControlableScripts(sourceObject), graph, playables); } // Connect Playables to Generic to Mixer root = ConnectPlayablesToMixer(graph, playables); } if (prefabGameObject != null) { s_CreatedPrefabs.Remove(prefabGameObject); } if (!root.IsValid()) { root = Playable.Create(graph); } return(root); }
public override Playable CreatePlayable(PlayableGraph graph, GameObject go) { template.gameObject = gameObject.Resolve(graph.GetResolver()); return(ScriptPlayable <EZActivationBehaviour> .Create(graph, template)); }
// Token: 0x060001A3 RID: 419 RVA: 0x00008660 File Offset: 0x00006860 public override Playable CreatePlayable(PlayableGraph graph, GameObject go) { if (this.prefabGameObject != null) { if (s_CreatedPrefabs.Contains(this.prefabGameObject)) { Debug.LogWarningFormat("Control Track Clip ({0}) is causing a prefab to instantiate itself recursively. Aborting further instances.", new object[] { base.name }); return(Playable.Create(graph, 0)); } s_CreatedPrefabs.Add(this.prefabGameObject); } Playable playable = Playable.Null; List <Playable> list = new List <Playable>(); GameObject gameObject = this.sourceGameObject.Resolve(graph.GetResolver()); if (this.prefabGameObject != null) { Transform parentTransform = (!(gameObject != null)) ? null : gameObject.transform; ScriptPlayable <ParticlePrefabControl> playable2 = ParticlePrefabControl.Create( graph, this.prefabGameObject, parentTransform, posOffset, followType, initResetRotate , this.realLife, this.scaleFactor ); gameObject = playable2.GetBehaviour().prefabInstance; list.Add(playable2); } //this.m_Duration = PlayableBinding.DefaultDuration; this.m_SupportLoop = false; if (gameObject != null) { // IList<PlayableDirector> directors = (!this.updateDirector) ? TestControlPlayableAsset.k_EmptyDirectorsList : this.GetComponent<PlayableDirector>(gameObject); // IList<ParticleSystem> particleSystems = (!this.updateParticle) ? ParticleControlPlayableAsset.k_EmptyParticlesList : this.GetParticleSystemRoots(gameObject); IList <ParticleSystem> particleSystems = ((!this.updateParticle) || (realLife > 0f && Application.isPlaying)) ? ParticleControlPlayableAsset.k_EmptyParticlesList : this.GetParticleSystemRoots(gameObject); //this.UpdateDurationAndLoopFlag(directors, particleSystems); PlayableDirector component = go.GetComponent <PlayableDirector>(); if (component != null) { this.m_ControlDirectorAsset = component.playableAsset; } if (go == gameObject && this.prefabGameObject == null) { Debug.LogWarningFormat("Control Playable ({0}) is referencing the same PlayableDirector component than the one in which it is playing.", new object[] { base.name }); this.active = false; //if (!this.searchHierarchy) //{ // //this.updateDirector = false; //} } if (this.active && realLife < 0.01f) { this.CreateActivationPlayable(gameObject, graph, list); } //if (this.updateDirector) //{ // this.SearchHierarchyAndConnectDirector(directors, graph, list, this.prefabGameObject != null); //} if (this.updateParticle) { this.SearchHiearchyAndConnectParticleSystem(particleSystems, graph, list); } //if (this.updateITimeControl) //{ // TestControlPlayableAsset.SearchHierarchyAndConnectControlableScripts(TestControlPlayableAsset.GetControlableScripts(gameObject), graph, list); //} playable = ParticleControlPlayableAsset.ConnectPlayablesToMixer(graph, list); } if (this.prefabGameObject != null) { s_CreatedPrefabs.Remove(this.prefabGameObject); } if (!playable.IsValid <Playable>()) { playable = Playable.Create(graph, 0); } return(playable); }
public override Playable CreateTrackMixer(PlayableGraph graph, GameObject go, int inputCount) { foreach (TimelineClip timelineClip in base.GetClips()) { CinemachineShot cinemachineShot = (CinemachineShot)timelineClip.asset; CinemachineVirtualCameraBase cinemachineVirtualCameraBase = cinemachineShot.VirtualCamera.Resolve(graph.GetResolver()); if (cinemachineVirtualCameraBase != null) { timelineClip.displayName = cinemachineVirtualCameraBase.Name; } } ScriptPlayable <CinemachineMixer> playable = ScriptPlayable <CinemachineMixer> .Create(graph, 0); playable.SetInputCount(inputCount); return(playable); }