Ejemplo n.º 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);
         }
     }
 }
Ejemplo n.º 2
0
    public override void OnBehaviourPlay(Playable playable, FrameData info)
    {
        var bind = _director.GetGenericBinding(_bindPb.sourceObject);

        if (bind is Animator)
        {
            _target = (bind as Animator).transform;
        }
        else if (bind is GameObject)
        {
            _target = (bind as GameObject).transform;
        }
        else if (bind is Animation)
        {
            _target = (bind as Animation).transform;
        }
        if (_target != null && _fx_obj == null)
        {
            _fx_root = _target.transform.Find(_fx_path);
            if (_fx_root != null)
            {
                string hash = "fx" + _prefab.GetHashCode().ToString();
#if UNITY_EDITOR
                Transform tf = _fx_root.Find(hash);
                if (tf != null)
                {
                    if (Application.isPlaying)
                    {
                        GameObject.Destroy(tf.gameObject);
                    }
                    else
                    {
                        GameObject.DestroyImmediate(tf.gameObject);
                    }
                }
#endif
                _fx_obj = TimelineUtil.Load <GameObject>(_prefab, _fx_root, Vector3.zero, Quaternion.identity);
                //_fx_obj;
                _particles = _fx_obj.GetComponentsInChildren <ParticleSystem>();
                _fx_obj.transform.parent        = _fx_root;
                _fx_obj.transform.localPosition = _pos;
                _fx_obj.transform.localRotation = Quaternion.Euler(_rot);
                _fx_obj.transform.localScale    = _scale;
                _fx_obj.name = hash.ToString();
            }
        }
        if (_particles != null)
        {
            for (int i = 0; i < _particles.Length; i++)
            {
                _particles[i].Play();
            }
        }
    }
Ejemplo n.º 3
0
        protected override void OnInspectorClip(IClip c)
        {
            base.OnInspectorClip(c);
            XLogicClip clip = (XLogicClip)c;

            if (clip)
            {
                if (folds == null)
                {
                    folds = new bool[max];
                }
                LogicClipData data = clip.data as LogicClipData;
                len = data.effect?.Length ?? 0;
                if (len > 0)
                {
                    data.showShape = EditorGUILayout.Toggle("Show Attack Atea", data.showShape);
                    if (data.showShape)
                    {
                        data.attackShape = (AttackShape)EditorGUILayout.EnumPopup("Shape", data.attackShape);
                        if (data.attackShape == AttackShape.Rect)
                        {
                            data.attackArg  = EditorGUILayout.FloatField("length: ", data.attackArg);
                            data.attackArg2 = EditorGUILayout.FloatField("width: ", data.attackArg2);
                        }
                        else if (data.attackShape == AttackShape.Ring)
                        {
                            data.attackArg = EditorGUILayout.FloatField("radius: ", data.attackArg);
                        }
                        else if (data.attackShape == AttackShape.Sector)
                        {
                            data.attackArg  = EditorGUILayout.FloatField("radius: ", data.attackArg);
                            data.attackArg2 = EditorGUILayout.FloatField("angle: ", data.attackArg2);
                        }
                    }
                    for (int i = 0; i < len; i++)
                    {
                        EditorGUILayout.BeginHorizontal();
                        folds[i] = EditorGUILayout.Foldout(folds[i], (i + 1) + ": " + data.logicType[i]);
                        EditorGUILayout.Space();
                        if (GUILayout.Button("x", TimelineStyles.bottomShadow, GUILayout.MaxWidth(20)))
                        {
                            data.effect    = TimelineUtil.Remv(data.effect, i);
                            data.logicType = TimelineUtil.Remv(data.logicType, i);
                            GUIUtility.ExitGUI();
                        }
                        EditorGUILayout.EndHorizontal();
                        if (folds[i])
                        {
                            data.logicType[i] = (LogicType)EditorGUILayout.EnumPopup(" type", data.logicType[i]);
                            data.effect[i]    = EditorGUILayout.FloatField(" effect", data.effect[i]);
                            if (data.logicType[i] == LogicType.MAX)
                            {
                                EditorGUILayout.HelpBox("max is attr", MessageType.Error);
                            }
                        }
                        EditorGUILayout.Space();
                    }
                }
                if (GUILayout.Button(" Add"))
                {
                    if (data.effect?.Length >= max)
                    {
                        EditorUtility.DisplayDialog("warn", "max attribute is: " + max, "ok");
                    }
                    else
                    {
                        TimelineUtil.Add(ref data.logicType, LogicType.HP);
                        TimelineUtil.Add(ref data.effect, 0.5f);
                    }
                }
                EditorGUILayout.Space();
            }
        }
Ejemplo n.º 4
0
        private void AddMark()
        {
            MarkConfig config = new MarkConfig();

            TimelineUtil.Add(ref conf.marks, config);
        }