Example #1
0
 public override AnimatorTimeline.JSONInit getJSONInit(AMITarget target)
 {
     if (!_obj || keys.Count <= 0)
     {
         return(null);
     }
     AnimatorTimeline.JSONInit init = new AnimatorTimeline.JSONInit();
     init.type = "position";
     init.go   = _obj.gameObject.name;
     AnimatorTimeline.JSONVector3 v = new AnimatorTimeline.JSONVector3();
     v.setValue(getInitialPosition());
     init.position = v;
     return(init);
 }
Example #2
0
        public override AnimatorTimeline.JSONInit getJSONInit(AMITarget target)
        {
            if (!obj || keys.Count <= 0)
            {
                return(null);
            }
            AnimatorTimeline.JSONInit init = new AnimatorTimeline.JSONInit();
            init.type = "orientation";
            init.go   = obj.gameObject.name;
            Transform _target            = getInitialTarget(target);
            int       start_frame        = keys[0].frame;
            AMTrack   _translation_track = null;
            //if(start_frame > 0) _translation_track = parentTake.getTranslationTrackForTransform(_target);
            Vector3 _lookv3 = _target.transform.position;

            if (_translation_track)
            {
                _lookv3 = (_translation_track as AMTranslationTrack).getPositionAtFrame((_translation_track as AMTranslationTrack).GetTarget(target) as Transform, start_frame, 0, true);
            }
            AnimatorTimeline.JSONVector3 v = new AnimatorTimeline.JSONVector3();
            v.setValue(_lookv3);
            init.position = v;
            return(init);
        }
Example #3
0
 public virtual AnimatorTimeline.JSONEventParameter toJSON()
 {
     AnimatorTimeline.JSONEventParameter e = new AnimatorTimeline.JSONEventParameter();
     e.valueType = valueType;
     if (valueType == (int)ValueType.Boolean)
     {
         e.val_bool = val_bool;
     }
     if (valueType == (int)ValueType.String)
     {
         e.val_string = (val_string /* as object*/);
     }
     if (valueType == (int)ValueType.Char)
     {
         if (val_string == null || val_string.Length <= 0)
         {
             e.val_string = "\0";
         }
         e.val_string = "" + val_string[0];
     }
     if (valueType == (int)ValueType.Integer || valueType == (int)ValueType.Long)
     {
         e.val_int = (val_int /* as object*/);
     }
     if (valueType == (int)ValueType.Float || valueType == (int)ValueType.Double)
     {
         e.val_float = (val_float /* as object*/);
     }
     if (valueType == (int)ValueType.Vector2)
     {
         AnimatorTimeline.JSONVector2 v2 = new AnimatorTimeline.JSONVector2();
         v2.setValue(val_vect2);
         e.val_vect2 = v2;
     }
     if (valueType == (int)ValueType.Vector3)
     {
         AnimatorTimeline.JSONVector3 v3 = new AnimatorTimeline.JSONVector3();
         v3.setValue(val_vect3);
         e.val_vect3 = v3;
     }
     if (valueType == (int)ValueType.Vector4)
     {
         AnimatorTimeline.JSONVector4 v4 = new AnimatorTimeline.JSONVector4();
         v4.setValue(val_vect4);
         e.val_vect4 = v4;
     }
     if (valueType == (int)ValueType.Color)
     {
         AnimatorTimeline.JSONColor c = new AnimatorTimeline.JSONColor();
         c.setValue(val_color);
         e.val_color = c;
     }
     if (valueType == (int)ValueType.Rect)
     {
         AnimatorTimeline.JSONRect r = new AnimatorTimeline.JSONRect();
         r.setValue(val_rect);
         e.val_rect = r;
     }
     if (valueType == (int)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);
 }