Advertisement
Guest User

Untitled

a guest
Oct 13th, 2015
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.01 KB | None | 0 0
  1.  
  2. void ModelController::RecursiveSetAnimation(Node* noed, String ani, bool loop, unsigned char layer)
  3. {
  4.     if (noed->HasComponent<AnimationController>())
  5.     {
  6.         String fileName = noed->GetVar("fileName").GetString();
  7.  
  8.         String aniPath = "Models/" + fileName + "/" + ani + ".ani";
  9.  
  10.         if (main_->cache_->Exists(aniPath))
  11.         {
  12.             if (( (noed->GetComponent<AnimationController>()->IsPlaying(aniPath) == false)
  13.                     && (noed->GetComponent<AnimationController>()->IsFadingIn(aniPath) == false) )
  14.                     || (noed->GetComponent<AnimationController>()->IsFadingOut(aniPath) == true) )
  15.             {
  16.                 noed->GetComponent<AnimationController>()->StopLayer(0, 0.0f);
  17.                 noed->GetComponent<AnimationController>()->PlayExclusive(aniPath, layer, loop, 0.0f);
  18.  
  19.                 if (!loop)
  20.                 {
  21.                     noed->GetComponent<AnimationController>()->SetAutoFade(aniPath, 0.25f);
  22.                 }
  23.             }
  24.             else
  25.             {
  26.                 return;
  27.             }
  28.         }
  29.     }
  30.  
  31.     for (int x = 0; x < noed->GetNumChildren(); x++)
  32.     {
  33.         RecursiveSetAnimation(noed->GetChild(x), ani, loop, layer);
  34.     }
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement