Commits

Jody McAdams committed ef91d2d

pause ability

Comments (0)

Files changed (2)

Libraries/Animation/Animation.cpp

     animDir = 1.0f;
 	totalAnimTime = animTime;
     currT = 0.0f;
-    animSpeed = 0.2f;
+    animSpeed = 1.0f;
     numAnimValues = MAX_NUM_ANIM_VALUES;
     animMode = mode;
+	endPauseTime = 0.0f;
+	pauseTimer = 0.0f;
+	  
+	if(mode == AnimMode_PingPong)
+	{
+		totalAnimTime *= 0.5f;
+	}
     
     SetValues(valueArray,numValues);
   }
   
   void Animation::Update(float timeDelta)
   {
+	if(pauseTimer > 0.0f)
+	{
+		pauseTimer -= animSpeed*timeDelta;
+		return;
+	}
+	  
     switch(animMode)
     {
       case AnimMode_Wrap:
         if(currT >= totalAnimTime)
         {
           currT -= totalAnimTime;
+			
+		  pauseTimer += endPauseTime;
         }
         
         break;
         {
 		  currT = totalAnimTime - (currT - totalAnimTime);
           animDir = -1.0f;
+			
+          pauseTimer += endPauseTime;
         }
         else if(currT <= 0.0f)
         {

Libraries/Animation/Animation.h

 
 	float animValues[MAX_NUM_ANIM_VALUES];
 	int numAnimValues;
+	
+	float endPauseTime;
+	float pauseTimer;
   
-  AnimMode animMode;
+	AnimMode animMode;
 	
 private: