예제 #1
0
 public void OnNotify(Playable origin, INotification notification)
 {
     if (director == null)
     {
         Awake();
     }
     if (notification is JumpSignalEmmiter)
     {
         JumpSignalEmmiter signal = notification as JumpSignalEmmiter;
         director.time = signal.jumpTime;
     }
     else if (notification is SlowSignalEmitter)
     {
         SlowSignalEmitter signal = notification as SlowSignalEmitter;
         director.playableGraph.GetRootPlayable(0).SetSpeed(signal.slowRate);
     }
     else if (notification is ActiveSignalEmmiter)
     {
         ActiveSignalEmmiter signal = notification as ActiveSignalEmmiter;
         TrackAsset          track  = TimelineUtil.GetRootTrack(signal);
         Transform           tf     = ExternalHelp.FetchAttachOfTrack(director, track);
         if (tf)
         {
             tf.gameObject.SetActive(signal.Active);
         }
     }
 }
예제 #2
0
        private void OnEnable()
        {
            PlayableDirector director = GameObject.FindObjectOfType <PlayableDirector>();

            signal = target as AnchorSignalEmitter;
            track  = signal.parent.parent as TrackAsset;
            bindTf = ExternalHelp.FetchAttachOfTrack(director, track);
        }
예제 #3
0
        public override void OnInspectorGUI()
        {
            BoneFxAsset asset = target as BoneFxAsset;

            if (director == null)
            {
                director = GameObject.FindObjectOfType <PlayableDirector>();
            }
            EditorGUILayout.Space();
            prefabGo = EditorGUILayout.ObjectField("Fx Prefab", prefabGo, typeof(GameObject), true) as GameObject;
            if (prefabGo != null)
            {
                string path = AssetDatabase.GetAssetPath(prefabGo);
                asset.prefab = path.Replace("Assets/BundleRes/", string.Empty).Replace(".prefab", string.Empty);
                if (!path.Contains("BundleRes") || !path.EndsWith(".prefab"))
                {
                    EditorGUILayout.HelpBox("The fx that you selected is invalid", MessageType.Error);
                }
            }
            if (boneGo == null && !string.IsNullOrEmpty(asset.prefab))
            {
                string path = "Assets/BundleRes/" + asset.prefab + ".prefab";
                prefabGo = AssetDatabase.LoadAssetAtPath <GameObject>(path);
                if (prefabGo == null)
                {
                    EditorGUILayout.HelpBox("AssetPath is invalid", MessageType.Error);
                }
            }
            EditorGUILayout.LabelField(asset.prefab);
            boneGo = EditorGUILayout.ObjectField("Select Bone", boneGo, typeof(GameObject), true) as GameObject;
            EditorGUILayout.LabelField(asset.fxPath);
            if (boneGo != null)
            {
                asset.fxPath = GetRootFullPath(boneGo.transform);
                if (string.IsNullOrEmpty(asset.fxPath) || !asset.fxPath.StartsWith("root"))
                {
                    EditorGUILayout.HelpBox("Avatar bone transform is invalid", MessageType.Error);
                }
            }
            else if (!string.IsNullOrEmpty(asset.fxPath))
            {
                if (asset.track != null)
                {
                    var       binding = director.GetGenericBinding(asset.track);
                    Transform tf      = ExternalHelp.FetchAttachOfTrack(director, asset.track);
                    if (tf)
                    {
                        tf = tf.GetChild(0).Find(asset.fxPath);
                        if (tf)
                        {
                            boneGo = tf.gameObject;
                        }
                    }
                }
            }
            DrawTransform();
            PreviewFx();
        }
예제 #4
0
    public override Playable CreatePlayable(PlayableGraph graph, GameObject owner)
    {
        var             director = owner.GetComponent <PlayableDirector>();
        Transform       tf       = ExternalHelp.FetchAttachOfTrack(director, track);
        AnchorBehaviour beha     = new AnchorBehaviour();

        beha.Set(clip_pos, clip_rot, tf, director);
        return(ScriptPlayable <AnchorBehaviour> .Create(graph, beha));
    }