Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public bool isRunning = false;
- public bool isTracking = false;
- public bool isPaused = false;
- public float timer1 = 0f;
- private float timer2 = 0f;
- public int axisValue1 = 0;
- void CheckIfRunning()
- {
- if (player.GetAxisRaw("Horizontal") != 0 && !isTracking )
- {
- isTracking = true;
- axisValue1 = (int)player.GetAxisRaw("Horizontal");
- timer1 = Time.time;
- }
- if (isTracking && player.GetAxisRaw("Horizontal") == 0)
- {
- isTracking = true;
- isPaused = true;
- }
- if (isTracking && isPaused && axisValue1 == (int)player.GetAxisRaw("Horizontal") && Time.time < (timer1 + coolDown))
- {
- isRunning = true;
- }
- else
- {
- if (Time.time > (timer1 + coolDown))
- { isTracking = false; }
- if (!isTracking)
- { isPaused = false; }
- }
- if (axisValue1 == (int)player.GetAxisRaw("Horizontal") && isRunning)
- {
- moveSpeed = 3;
- }
- else if (axisValue1 != (int)player.GetAxisRaw("Horizontal") && isRunning)
- {
- moveSpeed = 1;
- isTracking = false;
- isRunning = false;
- isPaused = false;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement