Esempio n. 1
0
        /// <summary>
        /// Append animation paths to the controller
        /// </summary>
        /// <param name="flags">Append path flags</param>
        /// <param name="paths">Paths to append</param>
        private void AppendPaths(AppendFlagTypes flags, AnimationPlan paths)
        {
            var clonedPaths = new AnimationPath[paths.Count];

            for (int i = 0; i < paths.Count; i++)
            {
                clonedPaths[i] = paths[i].Clone();
            }

            if (this.animationPaths.Count > 0)
            {
                AnimationPath last;
                AnimationPath next;

                if (flags == AppendFlagTypes.ClearCurrent)
                {
                    last = this.animationPaths[this.animationPaths.Count - 1];
                    next = clonedPaths[0];

                    //Clear all paths
                    this.animationPaths.Clear();
                }
                else if (flags == AppendFlagTypes.EndsCurrent && this.CurrentIndex < this.animationPaths.Count)
                {
                    last = this.animationPaths[this.CurrentIndex];
                    next = clonedPaths[0];

                    //Remove all paths from current to end
                    if (this.CurrentIndex + 1 < this.animationPaths.Count)
                    {
                        this.animationPaths.RemoveRange(
                            this.CurrentIndex + 1,
                            this.animationPaths.Count - (this.CurrentIndex + 1));
                    }

                    //Mark current path for ending
                    last.End();
                }
                else
                {
                    last = this.animationPaths[this.animationPaths.Count - 1];
                    next = clonedPaths[0];
                }

                //Adds transitions from current path item to the first added item
                last.ConnectTo(next);
            }

            this.animationPaths.AddRange(clonedPaths);

            if (this.CurrentIndex < 0)
            {
                this.CurrentIndex = 0;
            }
        }
Esempio n. 2
0
 /// <summary>
 /// Sets the specified past as current path list
 /// </summary>
 /// <param name="paths">Animation path list</param>
 public void SetPath(AnimationPlan paths)
 {
     this.AppendPaths(AppendFlagTypes.ClearCurrent, paths);
 }
Esempio n. 3
0
 /// <summary>
 /// Adds clips to the controller clips list and ends the current animation
 /// </summary>
 /// <param name="paths">Animation path list</param>
 public void ContinuePath(AnimationPlan paths)
 {
     this.AppendPaths(AppendFlagTypes.EndsCurrent, paths);
 }
Esempio n. 4
0
 /// <summary>
 /// Adds clips to the controller clips list
 /// </summary>
 /// <param name="paths">Animation path list</param>
 public void AddPath(AnimationPlan paths)
 {
     this.AppendPaths(AppendFlagTypes.None, paths);
 }