public override void OnPlayableDestroy(Playable playable) { if (!(this.gameObject == null) && this.m_InitialState != ActivationControlPlayable.InitialState.Unset) { ActivationControlPlayable.PostPlaybackState postPlaybackState = this.postPlayback; if (postPlaybackState != ActivationControlPlayable.PostPlaybackState.Active) { if (postPlaybackState != ActivationControlPlayable.PostPlaybackState.Inactive) { if (postPlaybackState == ActivationControlPlayable.PostPlaybackState.Revert) { this.gameObject.SetActive(this.m_InitialState == ActivationControlPlayable.InitialState.Active); } } else { this.gameObject.SetActive(false); } } else { this.gameObject.SetActive(true); } } }
/// <summary> /// Creates a ScriptPlayable with an ActivationControlPlayable behaviour attached /// </summary> /// <param name="graph">PlayableGraph that will own the playable</param> /// <param name="gameObject">The GameObject that triggered the graph build</param> /// <param name="postPlaybackState">The state to leave the gameObject after the graph is stopped</param> /// <returns>Returns a playable that controls activation of a game object</returns> public static ScriptPlayable <ActivationControlPlayable> Create(PlayableGraph graph, GameObject gameObject, ActivationControlPlayable.PostPlaybackState postPlaybackState) { if (gameObject == null) { return(ScriptPlayable <ActivationControlPlayable> .Null); } var handle = ScriptPlayable <ActivationControlPlayable> .Create(graph); var playable = handle.GetBehaviour(); playable.gameObject = gameObject; playable.postPlayback = postPlaybackState; return(handle); }
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); }