Example #1
0
        /*!
         * Plays the named animation on the current avatar.
         * The animation will not be played if it has not already been loaded.
         * @param name	name of animation to play
         * @param blend	time in seconds to blend to this animation (0 = no blending)
         *
         * @see LoadAnimation PauseAnimation
         */
        public virtual void PlayAnimation(String name, float blend)
        {
            SharedWorld world = SharedWorld.Get();

            if (nowPlaying != null)
            {
                return;
            }
            try
            {
                Group g = scriptor.Find(name + '.', Group.FIND_START | Group.FIND_CHILD);

                world.SuspendScene();
                if (g != null)
                {
                    scriptor.End();
                    nowPlaying = g as Engine;
                    scriptor.Begin(g.Name);
                }
                else
                {
                    nowPlaying = null;
                }
            }
            catch (Exception ex)
            {
                SharedWorld.LogError("PlayAnimation EXCEPTION " + ex.Message);
                nowPlaying = null;
            }
            world.ResumeScene();
        }
Example #2
0
 /*!
  * Plays the named animation on the current avatar.
  * The animation will not be played if it has not already been loaded.
  *
  * @see LoadAnimation PauseAnimation
  */
 public void PlayAnimation(string name)
 {
     try
     {
         Viewer3D viewer   = Viewer as Viewer3D;
         string   skelname = ConnectSkeleton();
         Scriptor scp      = _scriptor;
         if (skelname != null)
         {
             if (name != null)
             {
                 scp.Begin(name + skelname);
             }
             else
             {
                 scp.Begin(_animName);
             }
         }
     }
     catch (Exception ex)
     {
         SharedWorld.LogError("PlayAnimation EXCEPTION " + ex.Message);
     }
 }