Advertisement
Guest User

Untitled

a guest
Oct 18th, 2015
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.33 KB | None | 0 0
  1. public bool isRunning = false;
  2. public bool isTracking = false;
  3. public bool isPaused = false;
  4. public float timer1 = 0f;
  5. private float timer2 = 0f;
  6. public int axisValue1 = 0;
  7.  
  8.  
  9. void CheckIfRunning()
  10. {
  11. if (player.GetAxisRaw("Horizontal") != 0 && !isTracking )
  12. {
  13. isTracking = true;
  14. axisValue1 = (int)player.GetAxisRaw("Horizontal");
  15. timer1 = Time.time;
  16. }
  17.  
  18. if (isTracking && player.GetAxisRaw("Horizontal") == 0)
  19. {
  20. isTracking = true;
  21. isPaused = true;
  22.  
  23. }
  24.  
  25. if (isTracking && isPaused && axisValue1 == (int)player.GetAxisRaw("Horizontal") && Time.time < (timer1 + coolDown))
  26. {
  27. isRunning = true;
  28. }
  29. else
  30. {
  31. if (Time.time > (timer1 + coolDown))
  32. { isTracking = false; }
  33.  
  34. if (!isTracking)
  35. { isPaused = false; }
  36. }
  37.  
  38. if (axisValue1 == (int)player.GetAxisRaw("Horizontal") && isRunning)
  39. {
  40. moveSpeed = 3;
  41. }
  42. else if (axisValue1 != (int)player.GetAxisRaw("Horizontal") && isRunning)
  43. {
  44. moveSpeed = 1;
  45. isTracking = false;
  46. isRunning = false;
  47. isPaused = false;
  48. }
  49.  
  50.  
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement