Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class Pause : MonoBehaviour {
- public static Pause instance;
- public float movementTime;
- //public float speed;
- public Transform target;
- public Transform target2;
- bool paused;
- void Start () {
- }
- void Update ()
- {
- float elapsedTime = 0;
- float percentageComplete = 0;
- while (percentageComplete < 1.0f && paused == true) {
- percentageComplete = elapsedTime / movementTime;
- transform.position = Vector3.Lerp (transform.position, target.position, percentageComplete);
- Debug.Log ("true");
- elapsedTime += Time.deltaTime;
- }
- //transform.position = Vector3.Lerp (transform.position, target.position, speed * Time.deltaTime);
- }
- //if (paused == true)
- void Awake()
- {
- if (instance == null)
- instance = this;
- }
- public void OnPause () {
- paused = true;
- }
- public void OnResume () {
- //paused = false;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement