Guest User

Untitled

a guest
Apr 7th, 2014
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1.  
  2.  
  3. var framesPerSecond = 60.0;
  4. var index : int;
  5.  
  6. var Fightanim : Object[];
  7. var fightPlay = false;
  8.  
  9. function Start(){
  10. Fightanim = Resources.LoadAll("Fight", Texture2D);
  11. }
  12.  
  13. function Update () {
  14. DoPlay();
  15. }
  16.  
  17. function DoPlay(){
  18. if(fightPlay == true){
  19. fightAnimShow();
  20. }
  21. }
  22.  
  23. function fightAnimShow(){
  24. index = Time.time * framesPerSecond;
  25. index = index % Fightanim.Length;
  26. renderer.material.mainTexture = Fightanim[index] as Texture2D;
  27.  
  28. yield WaitForSeconds (0.1);
  29. if (index > Fightanim.length-2)
  30. fightPlay = false;
  31. }
Advertisement
Add Comment
Please, Sign In to add comment