Exemplo n.º 1
0
 public override AnimateTimeline.JSONInit getJSONInit(ITarget target)
 {
     if (!_obj || keys.Count <= 0)
     {
         return(null);
     }
     AnimateTimeline.JSONInit init = new AnimateTimeline.JSONInit();
     init.type = "position";
     init.go   = _obj.gameObject.name;
     AnimateTimeline.JSONVector3 v = new AnimateTimeline.JSONVector3();
     v.setValue(getInitialPosition());
     init.position = v;
     return(init);
 }
Exemplo n.º 2
0
        public override AnimateTimeline.JSONInit getJSONInit(ITarget target)
        {
            if (!_obj || keys.Count <= 0)
            {
                return(null);
            }
            var init = new AnimateTimeline.JSONInit();

            init.type = "scale";
            init.go   = _obj.gameObject.name;
            var s = new AnimateTimeline.JSONVector3();

            s.setValue(getInitialScale());
            init.scale = s;
            return(init);
        }
Exemplo n.º 3
0
        public override AnimateTimeline.JSONInit getJSONInit(ITarget target)
        {
            if (!obj || keys.Count <= 0)
            {
                return(null);
            }
            AnimateTimeline.JSONInit init = new AnimateTimeline.JSONInit();
            init.type = "orientation";
            init.go   = obj.gameObject.name;
            Transform _target            = getInitialTarget(target);
            int       start_frame        = keys[0].frame;
            Track     _translation_track = null;
            //if(start_frame > 0) _translation_track = parentTake.getTranslationTrackForTransform(_target);
            Vector3 _lookv3 = _target.transform.position;

            if (_translation_track != null)
            {
                _lookv3 = (_translation_track as TranslationTrack).getPositionAtFrame((_translation_track as TranslationTrack).GetTarget(target) as Transform, start_frame, 0, true);
            }
            AnimateTimeline.JSONVector3 v = new AnimateTimeline.JSONVector3();
            v.setValue(_lookv3);
            init.position = v;
            return(init);
        }
Exemplo n.º 4
0
 public virtual AnimateTimeline.JSONEventParameter toJSON()
 {
     AnimateTimeline.JSONEventParameter e = new AnimateTimeline.JSONEventParameter();
     e.valueType = valueType;
     if (valueType == ValueType.Boolean)
     {
         e.val_bool = val_bool;
     }
     if (valueType == ValueType.String)
     {
         e.val_string = (val_string /* as object*/);
     }
     if (valueType == ValueType.Char)
     {
         if (val_string == null || val_string.Length <= 0)
         {
             e.val_string = "\0";
         }
         e.val_string = "" + val_string[0];
     }
     if (valueType == ValueType.Integer || valueType == ValueType.Long)
     {
         e.val_int = (val_int /* as object*/);
     }
     if (valueType == ValueType.Float || valueType == ValueType.Double)
     {
         e.val_float = (val_float /* as object*/);
     }
     if (valueType == ValueType.Vector2)
     {
         AnimateTimeline.JSONVector2 v2 = new AnimateTimeline.JSONVector2();
         v2.setValue(val_vect2);
         e.val_vect2 = v2;
     }
     if (valueType == ValueType.Vector3)
     {
         AnimateTimeline.JSONVector3 v3 = new AnimateTimeline.JSONVector3();
         v3.setValue(val_vect3);
         e.val_vect3 = v3;
     }
     if (valueType == ValueType.Vector4)
     {
         AnimateTimeline.JSONVector4 v4 = new AnimateTimeline.JSONVector4();
         v4.setValue(val_vect4);
         e.val_vect4 = v4;
     }
     if (valueType == ValueType.Color)
     {
         AnimateTimeline.JSONColor c = new AnimateTimeline.JSONColor();
         c.setValue(val_color);
         e.val_color = c;
     }
     if (valueType == ValueType.Rect)
     {
         AnimateTimeline.JSONRect r = new AnimateTimeline.JSONRect();
         r.setValue(val_rect);
         e.val_rect = r;
     }
     if (valueType == ValueType.Object)
     {
         if (val_obj.GetType() != typeof(GameObject))
         {
             // component
             e.val_obj_extra = val_obj.name;
             e.val_obj       = val_obj.GetType().Name;
         }
         else
         {
             // gameobject
             e.val_obj_extra = null;
             e.val_obj       = val_obj.name;
         }
     }
     //Debug.LogError("Animator: Type not found for Event Parameter.");
     return(e);
 }