Advertisement
Guest User

Untitled

a guest
Jul 24th, 2017
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4.  
  5. public class Pause : MonoBehaviour {
  6.  
  7. public static Pause instance;
  8.  
  9. public float movementTime;
  10.  
  11. //public float speed;
  12. public Transform target;
  13. public Transform target2;
  14. bool paused;
  15.  
  16. void Start () {
  17. }
  18.  
  19. void Update ()
  20. {
  21. float elapsedTime = 0;
  22. float percentageComplete = 0;
  23.  
  24. while (percentageComplete < 1.0f && paused == true) {
  25. percentageComplete = elapsedTime / movementTime;
  26. transform.position = Vector3.Lerp (transform.position, target.position, percentageComplete);
  27. Debug.Log ("true");
  28. elapsedTime += Time.deltaTime;
  29. }
  30. //transform.position = Vector3.Lerp (transform.position, target.position, speed * Time.deltaTime);
  31. }
  32.  
  33. //if (paused == true)
  34.  
  35.  
  36.  
  37. void Awake()
  38. {
  39. if (instance == null)
  40. instance = this;
  41. }
  42.  
  43. public void OnPause () {
  44. paused = true;
  45. }
  46.  
  47. public void OnResume () {
  48. //paused = false;
  49. }
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement