public static void Update(float dt) { AnimationFrame currentFrame = null; AnimationFrame resultFrame = null; AnimationFrame nextFrame = null; switch (m_State) { case State.Animating: // animating so we only need to worry about the current ani m_CurrentAnimation.Update(dt); resultFrame = m_CurrentAnimation.GetCurrentFrame(); if (m_CurrentAnimation.Finished) { // get the blender to use m_Blender = GetNextBlender(); m_Blender.Start(); // get the next animation we can blend to m_NextAnimation = GetNextAnimation(); m_NextAnimation.Start(); // Assign the satellite devices their pattern // parameters and launch the transmission in a new thread SatelliteDevices.SetSatelliteParameters(m_NextAnimation.GenerateSatelliteParameters()); Thread thread = new Thread(new ThreadStart(SatelliteDevices.UpdateSatellites)); thread.IsBackground = true; thread.Start(); //SatelliteDevices.UpdateSatellites(); m_State = State.Blending; } break; case State.Blending: // update both anis since we're blending between the two m_CurrentAnimation.Update(dt); m_NextAnimation.Update(dt); currentFrame = m_CurrentAnimation.GetCurrentFrame(); nextFrame = m_NextAnimation.GetCurrentFrame(); resultFrame = m_Blender.Calculate(dt, currentFrame, nextFrame); if (m_Blender.Finished) { // done blending the current to next. Next now is current. m_State = State.Animating; m_CurrentAnimation.Stop(); m_CurrentAnimation = m_NextAnimation; } break; } // let the dome know about the new frame Dome.SetFrame(resultFrame); }
static AnimationManager() { m_Random = new Random(Environment.TickCount); m_Blender = new Linear(); //InitBlenderList(); InitAnimationList(); // assume there is at least two animations m_CurrentAnimation = m_AnimationList[0]; m_NextAnimation = m_AnimationList[1]; }
static AnimationManager() { m_Random = new Random(Environment.TickCount); m_Blender = new Linear(); //InitBlenderList(); InitAnimationList(); // assume there is at least two animations m_CurrentAnimation = m_AnimationList[0]; m_NextAnimation = m_AnimationList[1]; MainForm.ConsoleWriteLine("AM: Loading '" + m_CurrentAnimation.Name + "'"); }
public static void Update(float dt) { AnimationFrame currentFrame = null; AnimationFrame resultFrame = null; AnimationFrame nextFrame = null; switch (m_State) { case State.Animating: // animating so we only need to worry about the current ani m_CurrentAnimation.Update(dt); resultFrame = m_CurrentAnimation.GetCurrentFrame(); if (m_CurrentAnimation.Finished) { // get the blender to use m_Blender = GetNextBlender(); m_Blender.Start(); // get the next animation we can blend to m_NextAnimation = GetNextAnimation(); m_NextAnimation.Start(); m_State = State.Blending; } break; case State.Blending: // update both anis since we're blending between the two m_CurrentAnimation.Update(dt); m_NextAnimation.Update(dt); currentFrame = m_CurrentAnimation.GetCurrentFrame(); nextFrame = m_NextAnimation.GetCurrentFrame(); resultFrame = m_Blender.Calculate(dt, currentFrame, nextFrame); if (m_Blender.Finished) { // done blending the current to next. Next now is current. m_State = State.Animating; m_CurrentAnimation.Stop(); m_CurrentAnimation = m_NextAnimation; } break; } // let the dome know about the new frame Dome.SetFrame(resultFrame); }