Guest User

Untitled

a guest
Oct 17th, 2017
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using System;
  5.  
  6. public class ime : MonoBehaviour {
  7.  
  8. DateTime tempo;
  9. TimeSpan Difernca;
  10.  
  11. void Start () {
  12. if (PlayerPrefs.HasKey("FechaU"))
  13. {
  14. tempo = Convert.ToDateTime(PlayerPrefs.GetString("FechaU"));
  15. print("Tempo Carregado");
  16. print(tempo.ToString());
  17.  
  18. Difernca = DateTime.Now - tempo;
  19.  
  20. if (Difernca.Minutes > 10)
  21. {
  22. print("10 minuts se passaram");
  23. }
  24. }
  25. else
  26. {
  27. print("Tempo nao carregado");
  28. }
  29.  
  30. }
  31.  
  32.  
  33. void Update () {
  34.  
  35. if (Input.GetKeyDown(KeyCode.Space))
  36. {
  37. GuardaTempo();
  38. }
  39.  
  40. }
  41.  
  42. public void GuardaTempo()
  43. {
  44. PlayerPrefs.SetString("FechaU", DateTime.Now.ToString());
  45. print("Tempo Guardado!!");
  46. }
  47.  
  48. }
Add Comment
Please, Sign In to add comment