Exemplo n.º 1
0
        // update cache (optimized)
        public override void updateCache(ITarget target)
        {
            base.updateCache(target);

            // get all paths and add them to the action list
            for (int i = 0; i < keys.Count; i++)
            {
                TranslationKey key = keys[i] as TranslationKey;

                var interp       = key.interp;
                var easeType     = key.easeType;
                var isConstSpeed = key.isConstSpeed;
                var orientMode   = key.orientMode;
                var lockAxis     = key.orientLockAxis;

                key.GeneratePath(this, i);

                //invalidate some keys in between
                if (key.path != null)
                {
                    int endInd = i + key.keyCount - 1;
                    if (endInd < keys.Count - 1 || key.interp != keys[endInd].interp) //don't count the last element if there are more keys ahead
                    {
                        endInd--;
                    }

                    for (int j = i + 1; j <= endInd; j++)
                    {
                        var _key = keys[j] as TranslationKey;

                        _key.interp         = interp;
                        _key.easeType       = easeType;
                        _key.isConstSpeed   = isConstSpeed;
                        _key.orientMode     = orientMode;
                        _key.orientLockAxis = lockAxis;
                        _key.Invalidate();
                    }

                    i = endInd;
                }
            }
        }
Exemplo n.º 2
0
        // update cache (optimized)
        public override void updateCache(ITarget target)
        {
            base.updateCache(target);

            // get all paths and add them to the action list
            for (int i = 0; i < keys.Count; i++)
            {
                TranslationKey key = keys[i] as TranslationKey;

                var interp   = key.interp;
                var easeType = key.easeType;

                key.version = version;

                key.GeneratePath(this, i);
                key.ClearCache();

                //invalidate some keys in between
                if (key.path.Length > 1)
                {
                    int endInd = i + key.path.Length - 1;
                    if (endInd < keys.Count - 1 || key.interp != keys[endInd].interp) //don't count the last element if there are more keys ahead
                    {
                        endInd--;
                    }

                    for (int j = i + 1; j <= endInd; j++)
                    {
                        key = keys[j] as TranslationKey;

                        key.version  = version;
                        key.interp   = interp;
                        key.easeType = easeType;
                        key.endFrame = key.frame;
                        key.path     = new Vector3[0];
                    }

                    i = endInd;
                }
            }
        }