// add key numeric
    public void addKey(int _frame, double val)
    {
        foreach (AMPropertyKey key in keys)
        {
            // if key exists on frame, update key
            if (key.frame == _frame)
            {
                key.setValue(val);
                // update cache
                updateCache();
                return;
            }
        }
        AMPropertyKey a = ScriptableObject.CreateInstance <AMPropertyKey>();

        a.frame = _frame;
        a.setValue(val);
        // set default ease type to linear
        a.easeType = (int)AMTween.EaseType.linear;
        // add a new key
        keys.Add(a);
        // update cache
        updateCache();
    }
    // add key mega morph
    public void addKeyMegaMorph(int _frame, List <float> channels)
    {
        foreach (AMPropertyKey key in keys)
        {
            // if key exists on frame, update key
            if (key.frame == _frame)
            {
                key.setValueMegaMorph(channels);
                // update cache
                updateCache();
                return;
            }
        }
        AMPropertyKey a = ScriptableObject.CreateInstance <AMPropertyKey>();

        a.frame = _frame;
        a.setValueMegaMorph(channels);
        // set default ease type to linear
        a.easeType = (int)AMTween.EaseType.easeInOutSine;
        // add a new key
        keys.Add(a);
        // update cache
        updateCache();
    }
Example #3
0
 public bool targetsAreEqual(int valueType, AMPropertyKey nextKey)
 {
     if(nextKey) {
         if(valueType == (int)AMPropertyTrack.ValueType.Integer || valueType == (int)AMPropertyTrack.ValueType.Long || valueType == (int)AMPropertyTrack.ValueType.Float || valueType == (int)AMPropertyTrack.ValueType.Double)
             return val == nextKey.val;
         if(valueType == (int)AMPropertyTrack.ValueType.Vector2) return (vect2 == nextKey.vect2);
         if(valueType == (int)AMPropertyTrack.ValueType.Vector3) return (vect3 == nextKey.vect3);
         if(valueType == (int)AMPropertyTrack.ValueType.Color) return (color == nextKey.color); //return start_color.ToString()+" -> "+end_color.ToString();
         if(valueType == (int)AMPropertyTrack.ValueType.Rect) return (rect == nextKey.rect); //return start_rect.ToString()+" -> "+end_rect.ToString();
         if(valueType == (int)AMPropertyTrack.ValueType.Vector4) return (vect4 == nextKey.vect4);
         if(valueType == (int)AMPropertyTrack.ValueType.Quaternion) return (quat == nextKey.quat);
     }
     return false;
 }
Example #4
0
    public string getValueString(System.Type type, int valueType, AMPropertyKey nextKey, bool brief)
    {
        System.Text.StringBuilder s = new System.Text.StringBuilder();

        if(AMPropertyTrack.isValueTypeNumeric(valueType)) {
            //s+= start_val.ToString();
            s.Append(formatNumeric(val));
            if(!brief && nextKey) { s.Append(" -> "); s.Append(formatNumeric(nextKey.val)); }
            //if(!brief && endFrame != -1) s += " -> "+end_val.ToString();
        }
        else if(valueType == (int)AMPropertyTrack.ValueType.Bool) {
            s.Append(val > 0.0 ? "(true)" : "(false)");
        }
        else if(valueType == (int)AMPropertyTrack.ValueType.String) {
            s.AppendFormat("\"{0}\"", valString);
        }
        else if(valueType == (int)AMPropertyTrack.ValueType.Vector2) {
            s.Append(vect2.ToString());
            if(!brief && nextKey) { s.Append(" -> "); s.Append(nextKey.vect2.ToString()); }
        }
        else if(valueType == (int)AMPropertyTrack.ValueType.Vector3) {
            s.Append(vect3.ToString());
            if(!brief && nextKey) { s.Append(" -> "); s.Append(nextKey.vect3.ToString()); }
        }
        else if(valueType == (int)AMPropertyTrack.ValueType.Color) {
            //return null;
            s.Append(color.ToString());
            if(!brief && nextKey) { s.Append(" -> "); s.Append(nextKey.color.ToString()); }
        }
        else if(valueType == (int)AMPropertyTrack.ValueType.Rect) {
            //return null;
            s.Append(rect.ToString());
            if(!brief && nextKey) { s.Append(" -> "); s.Append(nextKey.rect.ToString()); }
        }
        else if(valueType == (int)AMPropertyTrack.ValueType.Vector4) {
            s.Append(vect4.ToString());
            if(!brief && nextKey) { s.Append(" -> "); s.Append(nextKey.vect4.ToString()); }
        }
        else if(valueType == (int)AMPropertyTrack.ValueType.Quaternion) {
            s.Append(quat.ToString());
            if(!brief && nextKey) { s.Append(" -> "); s.Append(nextKey.quat.ToString()); }
        }
        else if(valueType == (int)AMPropertyTrack.ValueType.Sprite) {
            s.AppendFormat("\"{0}\"", valObj ? valObj.name : "none");
        }
        else if(valueType == (int)AMPropertyTrack.ValueType.Enum) {
            s.Append(System.Enum.ToObject(type, (int)val).ToString());
        }
        return s.ToString();
    }