Esempio n. 1
0
        // returns true if autoKey successful
        public bool autoKey(AMITarget itarget, OnAddKey addCall, Transform aobj, int frame, int frameRate)
        {
            Transform t = GetTarget(itarget) as Transform;

            if (!t || aobj != t)
            {
                return(false);
            }

            if (keys.Count <= 0)
            {
                if (GetPosition(t) != cachedInitialPosition)
                {
                    // if updated position, addkey
                    addKey(itarget, addCall, frame, GetPosition(t));
                    return(true);
                }
                return(false);
            }

            Vector3 oldPos = getPositionAtFrame(t, frame, frameRate, false);

            if (GetPosition(t) != oldPos)
            {
                // if updated position, addkey
                addKey(itarget, addCall, frame, GetPosition(t));
                return(true);
            }

            return(false);
        }
Esempio n. 2
0
        // add a new key
        public void addKey(AMITarget itarget, OnAddKey addCall, int _frame, Vector3 _position, int _interp, int _easeType)
        {
            foreach (AMTranslationKey key in keys)
            {
                // if key exists on frame, update key
                if (key.frame == _frame)
                {
                    key.position = _position;
                    key.interp   = _interp;
                    key.easeType = _easeType;
                    // update cache
                    updateCache(itarget);
                    return;
                }
            }
            AMTranslationKey a = addCall(gameObject, typeof(AMTranslationKey)) as AMTranslationKey;

            a.frame    = _frame;
            a.position = _position;
            a.interp   = _interp;
            a.easeType = _easeType;

            // add a new key
            keys.Add(a);
            // update cache
            updateCache(itarget);
        }
Esempio n. 3
0
        // returns true if autoKey successful, sets output key
        public bool autoKey(AMITarget itarget, OnAddKey addCall, Transform aObj, int frame, int frameRate)
        {
            Transform t = GetTarget(itarget) as Transform;

            if (!t || t != aObj)
            {
                return(false);
            }
            Quaternion r = t.localRotation;

            if (keys.Count <= 0)
            {
                if (r != cachedInitialRotation)
                {
                    // if updated position, addkey
                    addKey(itarget, addCall, frame, r);
                    return(true);
                }

                return(false);
            }
            Quaternion oldRot = getRotationAtFrame(frame, frameRate);

            if (r != oldRot)
            {
                // if updated position, addkey
                addKey(itarget, addCall, frame, r);
                return(true);
            }

            return(false);
        }
 // add a new key
 public void addKey(AMITarget itarget, OnAddKey addCall, int _frame, Camera camera = null,/*int? type = null, Camera camera = null, Color? color = null,*/ AMCameraSwitcherKey keyToClone = null)
 {
     foreach(AMCameraSwitcherKey key in keys) {
         // if key exists on frame, update key
         if(key.frame == _frame) {
             if(camera != null) {
                 key.setCamera(itarget, camera);
                 key.type = 0;
                 updateCache(itarget);
             }
             return;
         }
     }
     AMCameraSwitcherKey a = addCall(gameObject, typeof(AMCameraSwitcherKey)) as AMCameraSwitcherKey;
     if(keyToClone) {
         keyToClone.CopyTo(a);
     }
     else {
         a.type = 0;
         a.still = !AMTakeData.isProLicense;
         a.easeType = (int)EaseType.EaseOutSine;
     }
     a.frame = _frame;
     if(camera != null) {
         a.setCamera(itarget, camera);
         a.type = 0;
     }
     // add a new key
     keys.Add(a);
     // update cache
     updateCache(itarget);
 }
Esempio n. 5
0
        // add a new key
        public void addKey(AMITarget target, OnAddKey addCall, int _frame, Quaternion _rotation)
        {
            foreach (AMRotationKey key in keys)
            {
                // if key exists on frame, update key
                if (key.frame == _frame)
                {
                    key.rotation = _rotation;
                    // update cache
                    updateCache(target);
                    return;
                }
            }
            AMRotationKey a = addCall(gameObject, typeof(AMRotationKey)) as AMRotationKey;

            a.frame    = _frame;
            a.rotation = _rotation;
            // set default ease type to linear
            a.easeType = (int)Ease.Linear;

            // add a new key
            keys.Add(a);
            // update cache
            updateCache(target);
        }
Esempio n. 6
0
 // add a new key
 public void addKey(AMITarget itarget, OnAddKey addCall, int _frame)
 {
     foreach(AMEventKey key in keys) {
         // if key exists on frame, do nothing
         if(key.frame == _frame) {
             return;
         }
     }
     AMEventKey a = addCall(gameObject, typeof(AMEventKey)) as AMEventKey;
     a.frame = _frame;
     // add a new key
     keys.Add(a);
     // update cache
     updateCache(itarget);
 }
Esempio n. 7
0
 // add a new key
 public void addKey(AMITarget target, OnAddKey addCall, int _frame)
 {
     foreach(AMGOSetActiveKey key in keys) {
         // if key exists on frame, update
         if(key.frame == _frame) {
             key.setActive = true;
             updateCache(target);
             return;
         }
     }
     AMGOSetActiveKey a = addCall(gameObject, typeof(AMGOSetActiveKey)) as AMGOSetActiveKey;
     a.frame = _frame;
     a.setActive = true;
     // add a new key
     keys.Add(a);
     // update cache
     updateCache(target);
 }
Esempio n. 8
0
        // add a new key
        public void addKey(AMITarget itarget, OnAddKey addCall, int _frame)
        {
            foreach (AMTriggerKey key in keys)
            {
                // if key exists on frame, do nothing
                if (key.frame == _frame)
                {
                    return;
                }
            }
            AMTriggerKey a = addCall(gameObject, typeof(AMTriggerKey)) as AMTriggerKey;

            a.frame = _frame;
            // add a new key
            keys.Add(a);
            // update cache
            updateCache(itarget);
        }
Esempio n. 9
0
 // add a new key
 public void addKey(AMITarget itarget, OnAddKey addCall, int _frame, AudioClip _clip, bool _loop)
 {
     foreach(AMAudioKey key in keys) {
         // if key exists on frame, update key
         if(key.frame == _frame) {
             key.audioClip = _clip;
             key.loop = _loop;
             // update cache
             updateCache(itarget);
         }
     }
     AMAudioKey a = addCall(gameObject, typeof(AMAudioKey)) as AMAudioKey;
     a.frame = _frame;
     a.audioClip = _clip;
     a.loop = _loop;
     // add a new key
     keys.Add(a);
     // update cache
     updateCache(itarget);
 }
Esempio n. 10
0
        // add a new key, default interpolation and easeType
        public void addKey(AMITarget itarget, OnAddKey addCall, int _frame, Vector3 _position)
        {
            foreach(AMTranslationKey key in keys) {
                // if key exists on frame, update key
                if(key.frame == _frame) {
                    key.position = _position;
                    // update cache
                    updateCache(itarget);
                    return;
                }
            }
            AMTranslationKey a = addCall(gameObject, typeof(AMTranslationKey)) as AMTranslationKey;
            a.frame = _frame;
            a.position = _position;

            // add a new key
            keys.Add(a);
            // update cache
            updateCache(itarget);
        }
Esempio n. 11
0
 // add a new key
 public void addKey(AMITarget itarget, OnAddKey addCall, int _frame, AnimationClip _clip, WrapMode _wrapMode)
 {
     foreach(AMAnimationKey key in keys) {
         // if key exists on frame, update key
         if(key.frame == _frame) {
             key.amClip = _clip;
             key.wrapMode = _wrapMode;
             // update cache
             updateCache(itarget);
             return;
         }
     }
     AMAnimationKey a = addCall(gameObject, typeof(AMAnimationKey)) as AMAnimationKey;
     a.frame = _frame;
     a.amClip = _clip;
     a.wrapMode = _wrapMode;
     // add a new key
     keys.Add(a);
     // update cache
     updateCache(itarget);
 }
Esempio n. 12
0
        // add a new key
        public void addKey(AMITarget target, OnAddKey addCall, int _frame)
        {
            foreach (AMGOSetActiveKey key in keys)
            {
                // if key exists on frame, update
                if (key.frame == _frame)
                {
                    key.setActive = true;
                    updateCache(target);
                    return;
                }
            }
            AMGOSetActiveKey a = addCall(gameObject, typeof(AMGOSetActiveKey)) as AMGOSetActiveKey;

            a.frame     = _frame;
            a.setActive = true;
            // add a new key
            keys.Add(a);
            // update cache
            updateCache(target);
        }
Esempio n. 13
0
 // add a new key
 public void addKey(AMITarget itarget, OnAddKey addCall, int _frame, Transform target)
 {
     foreach(AMOrientationKey key in keys) {
         // if key exists on frame, update key
         if(key.frame == _frame) {
             key.SetTarget(itarget, target);
             // update cache
             updateCache(itarget);
             return;
         }
     }
     AMOrientationKey a = addCall(gameObject, typeof(AMOrientationKey)) as AMOrientationKey;
     a.frame = _frame;
     a.SetTarget(itarget, target);
     // set default ease type to linear
     a.easeType = (int)0;// AMTween.EaseType.linear;
     // add a new key
     keys.Add(a);
     // update cache
     updateCache(itarget);
 }
Esempio n. 14
0
        // add a new key
        public void addKey(AMITarget target, OnAddKey addCall, int _frame, Quaternion _rotation)
        {
            foreach(AMRotationKey key in keys) {
                // if key exists on frame, update key
                if(key.frame == _frame) {
                    key.rotation = _rotation;
                    // update cache
                    updateCache(target);
                    return;
                }
            }
            AMRotationKey a = addCall(gameObject, typeof(AMRotationKey)) as AMRotationKey;
            a.frame = _frame;
            a.rotation = _rotation;
            // set default ease type to linear
            a.easeType = (int)EaseType.Linear;

            // add a new key
            keys.Add(a);
            // update cache
            updateCache(target);
        }
Esempio n. 15
0
        // add a new key
        public void addKey(AMITarget itarget, OnAddKey addCall, int _frame, Camera camera = null, /*int? type = null, Camera camera = null, Color? color = null,*/ AMCameraSwitcherKey keyToClone = null)
        {
            foreach (AMCameraSwitcherKey key in keys)
            {
                // if key exists on frame, update key
                if (key.frame == _frame)
                {
                    if (camera != null)
                    {
                        key.setCamera(itarget, camera);
                        key.type = 0;
                        updateCache(itarget);
                    }
                    return;
                }
            }
            AMCameraSwitcherKey a = addCall(gameObject, typeof(AMCameraSwitcherKey)) as AMCameraSwitcherKey;

            if (keyToClone)
            {
                keyToClone.CopyTo(a);
            }
            else
            {
                a.type     = 0;
                a.still    = !AMTakeData.isProLicense;
                a.easeType = (int)Ease.OutSine;
            }
            a.frame = _frame;
            if (camera != null)
            {
                a.setCamera(itarget, camera);
                a.type = 0;
            }
            // add a new key
            keys.Add(a);
            // update cache
            updateCache(itarget);
        }
Esempio n. 16
0
        // returns true if autoKey successful, sets output key
        public bool autoKey(AMITarget itarget, OnAddKey addCall, Transform aObj, int frame, int frameRate)
        {
            Transform t = GetTarget(itarget) as Transform;
            if(!t || t != aObj) { return false; }
            Quaternion r = t.localRotation;
            if(keys.Count <= 0) {
                if(r != cachedInitialRotation) {
                    // if updated position, addkey
                    addKey(itarget, addCall, frame, r);
                    return true;
                }

                return false;
            }
            Quaternion oldRot = getRotationAtFrame(frame, frameRate);
            if(r != oldRot) {
                // if updated position, addkey
                addKey(itarget, addCall, frame, r);
                return true;
            }

            return false;
        }
Esempio n. 17
0
        // add a new key
        public void addKey(AMITarget itarget, OnAddKey addCall, int _frame, AudioClip _clip, bool _loop)
        {
            foreach (AMAudioKey key in keys)
            {
                // if key exists on frame, update key
                if (key.frame == _frame)
                {
                    key.audioClip = _clip;
                    key.loop      = _loop;
                    // update cache
                    updateCache(itarget);
                }
            }
            AMAudioKey a = addCall(gameObject, typeof(AMAudioKey)) as AMAudioKey;

            a.frame     = _frame;
            a.audioClip = _clip;
            a.loop      = _loop;
            // add a new key
            keys.Add(a);
            // update cache
            updateCache(itarget);
        }
Esempio n. 18
0
        // add a new key
        public void addKey(AMITarget itarget, OnAddKey addCall, int _frame, AnimationClip _clip, WrapMode _wrapMode)
        {
            foreach (AMAnimationKey key in keys)
            {
                // if key exists on frame, update key
                if (key.frame == _frame)
                {
                    key.amClip   = _clip;
                    key.wrapMode = _wrapMode;
                    // update cache
                    updateCache(itarget);
                    return;
                }
            }
            AMAnimationKey a = addCall(gameObject, typeof(AMAnimationKey)) as AMAnimationKey;

            a.frame    = _frame;
            a.amClip   = _clip;
            a.wrapMode = _wrapMode;
            // add a new key
            keys.Add(a);
            // update cache
            updateCache(itarget);
        }
Esempio n. 19
0
        // add a new key
        public void addKey(AMITarget itarget, OnAddKey addCall, int _frame, Transform target)
        {
            foreach (AMOrientationKey key in keys)
            {
                // if key exists on frame, update key
                if (key.frame == _frame)
                {
                    key.SetTarget(itarget, target);
                    // update cache
                    updateCache(itarget);
                    return;
                }
            }
            AMOrientationKey a = addCall(gameObject, typeof(AMOrientationKey)) as AMOrientationKey;

            a.frame = _frame;
            a.SetTarget(itarget, target);
            // set default ease type to linear
            a.easeType = (int)Ease.Linear;    // AMTween.EaseType.linear;
            // add a new key
            keys.Add(a);
            // update cache
            updateCache(itarget);
        }
Esempio n. 20
0
        // add key
        public AMPropertyKey addKey(AMITarget target, OnAddKey addCall, int _frame)
        {
            Component comp = GetTargetComp(target);

            RefreshData(comp);

            AMPropertyKey k = null;

            foreach (AMPropertyKey key in keys)
            {
                // if key exists on frame, update key
                if (key.frame == _frame)
                {
                    k = key;
                }
            }

            if (k == null)
            {
                k        = addCall(gameObject, typeof(AMPropertyKey)) as AMPropertyKey;
                k.frame  = _frame;
                k.interp = (int)(canTween ? AMKey.Interpolation.Linear : AMKey.Interpolation.None);
                // add a new key
                keys.Add(k);
            }

            if (isValueTypeNumeric(valueType))
            {
                k.val = Convert.ToDouble(getCachedInfoValue(target));
            }
            else if (valueType == (int)ValueType.Bool)
            {
                k.valb = Convert.ToBoolean(getCachedInfoValue(target));
            }
            else if (valueType == (int)ValueType.String)
            {
                k.valString = Convert.ToString(getCachedInfoValue(target));
            }
            else if (valueType == (int)ValueType.Vector2)
            {
                k.vect2 = (Vector2)getCachedInfoValue(target);
            }
            else if (valueType == (int)ValueType.Vector3)
            {
                k.vect3 = (Vector3)getCachedInfoValue(target);
            }
            else if (valueType == (int)ValueType.Color)
            {
                k.color = (Color)getCachedInfoValue(target);
            }
            else if (valueType == (int)ValueType.Rect)
            {
                k.rect = (Rect)getCachedInfoValue(target);
            }
            else if (valueType == (int)ValueType.Vector4)
            {
                k.vect4 = (Vector4)getCachedInfoValue(target);
            }
            else if (valueType == (int)ValueType.Quaternion)
            {
                k.quat = (Quaternion)getCachedInfoValue(target);
            }
            else if (valueType == (int)ValueType.Sprite)
            {
                k.valObj = (UnityEngine.Object)getCachedInfoValue(target);
            }
            else if (valueType == (int)ValueType.Enum)
            {
                k.val = Convert.ToDouble(getCachedInfoValue(target));
            }
            else
            {
                Debug.LogError("Animator: Invalid ValueType " + valueType.ToString());
            }

            // update cache
            updateCache(target);
            return(k);
        }
Esempio n. 21
0
        // add key
        public AMPropertyKey addKey(AMITarget target, OnAddKey addCall, int _frame)
        {
            Component comp = GetTargetComp(target);
            RefreshData(comp);

            AMPropertyKey k = null;

            foreach(AMPropertyKey key in keys) {
                // if key exists on frame, update key
                if(key.frame == _frame) {
                    k = key;
                }
            }

            if(k == null) {
                k = addCall(gameObject, typeof(AMPropertyKey)) as AMPropertyKey;
                k.frame = _frame;
                k.interp = (int)(canTween ? AMKey.Interpolation.Linear : AMKey.Interpolation.None);
                // add a new key
                keys.Add(k);
            }

            if(isValueTypeNumeric(valueType))
                k.val = Convert.ToDouble(getCachedInfoValue(target));
            else if(valueType == (int)ValueType.Bool)
                k.valb = Convert.ToBoolean(getCachedInfoValue(target));
            else if(valueType == (int)ValueType.String)
                k.valString =Convert.ToString(getCachedInfoValue(target));
            else if(valueType == (int)ValueType.Vector2)
                k.vect2 = (Vector2)getCachedInfoValue(target);
            else if(valueType == (int)ValueType.Vector3)
                k.vect3 = (Vector3)getCachedInfoValue(target);
            else if(valueType == (int)ValueType.Color)
                k.color = (Color)getCachedInfoValue(target);
            else if(valueType == (int)ValueType.Rect)
                k.rect = (Rect)getCachedInfoValue(target);
            else if(valueType == (int)ValueType.Vector4)
                k.vect4 = (Vector4)getCachedInfoValue(target);
            else if(valueType == (int)ValueType.Quaternion)
                k.quat = (Quaternion)getCachedInfoValue(target);
            else if(valueType == (int)ValueType.Sprite)
                k.valObj = (UnityEngine.Object)getCachedInfoValue(target);
            else if(valueType == (int)ValueType.Enum)
                k.val = Convert.ToDouble(getCachedInfoValue(target));
            else {
                Debug.LogError("Animator: Invalid ValueType " + valueType.ToString());
            }

            // update cache
            updateCache(target);
            return k;
        }
Esempio n. 22
0
        // returns true if autoKey successful
        public bool autoKey(AMITarget itarget, OnAddKey addCall, Transform aobj, int frame, int frameRate)
        {
            Transform t = GetTarget(itarget) as Transform;
            if(!t || aobj != t) { return false; }

            if(keys.Count <= 0) {
                if(GetPosition(t) != cachedInitialPosition) {
                    // if updated position, addkey
                    addKey(itarget, addCall, frame, GetPosition(t));
                    return true;
                }
                return false;
            }

            Vector3 oldPos = getPositionAtFrame(t, frame, frameRate, false);
            if(GetPosition(t) != oldPos) {
                // if updated position, addkey
                addKey(itarget, addCall, frame, GetPosition(t));
                return true;
            }

            return false;
        }
 internal void OnAddKey_Trigger(PlayerState player) => OnAddKey?.Handle(args: new object[] { player }, unique: true);
Esempio n. 24
0
        public AMMaterialKey addKey(AMITarget target, OnAddKey addCall, int _frame)
        {
            Material mat = GetMaterial(target);
            //mat.get
            //

            AMMaterialKey k = null;

            foreach(AMMaterialKey key in keys) {
                // if key exists on frame, update key
                if(key.frame == _frame) {
                    k = key;
                }
            }

            if(k == null) {
                k = addCall(gameObject, typeof(AMMaterialKey)) as AMMaterialKey;
                k.frame = _frame;
                k.interp = (int)AMKey.Interpolation.Linear;
                // add a new key
                keys.Add(k);
            }

            //set value
            if(!string.IsNullOrEmpty(property)) {
                switch(_propertyType) {
                    case ValueType.Float:
                    case ValueType.Range:
                        k.val = mat.GetFloat(property);
                        break;
                    case ValueType.Vector:
                        k.vector = mat.GetVector(property);
                        break;
                    case ValueType.Color:
                        k.color = mat.GetColor(property);
                        break;
                    case ValueType.TexEnv:
                        k.texture = mat.GetTexture(property);
                        break;
                    case ValueType.TexOfs:
                        k.texOfs = mat.GetTextureOffset(property);
                        break;
                    case ValueType.TexScale:
                        k.texScale = mat.GetTextureScale(property);
                        break;
                }
            }
            else {
                Debug.LogWarning("Property is not set in: "+name);
            }

            updateCache(target);

            return k;
        }
Esempio n. 25
0
        public AMMaterialKey addKey(AMITarget target, OnAddKey addCall, int _frame)
        {
            Material mat = GetMaterial(target);
            //mat.get
            //

            AMMaterialKey k = null;

            foreach (AMMaterialKey key in keys)
            {
                // if key exists on frame, update key
                if (key.frame == _frame)
                {
                    k = key;
                }
            }

            if (k == null)
            {
                k        = addCall(gameObject, typeof(AMMaterialKey)) as AMMaterialKey;
                k.frame  = _frame;
                k.interp = (int)AMKey.Interpolation.Linear;
                // add a new key
                keys.Add(k);
            }

            //set value
            if (!string.IsNullOrEmpty(property))
            {
                switch (_propertyType)
                {
                case ValueType.Float:
                case ValueType.Range:
                    k.val = mat.GetFloat(property);
                    break;

                case ValueType.Vector:
                    k.vector = mat.GetVector(property);
                    break;

                case ValueType.Color:
                    k.color = mat.GetColor(property);
                    break;

                case ValueType.TexEnv:
                    k.texture = mat.GetTexture(property);
                    break;

                case ValueType.TexOfs:
                    k.texOfs = mat.GetTextureOffset(property);
                    break;

                case ValueType.TexScale:
                    k.texScale = mat.GetTextureScale(property);
                    break;
                }
            }
            else
            {
                Debug.LogWarning("Property is not set in: " + name);
            }

            updateCache(target);

            return(k);
        }