Advertisement
Guest User

Untitled

a guest
Jun 18th, 2019
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.33 KB | None | 0 0
  1. [SerializeField]
  2. private int index, index2 = 0;
  3. [SerializeField]
  4. private Vector3[] Myposic1, Myposic2;
  5. [SerializeField]
  6. private Button left, right;
  7. [SerializeField]
  8. private float time;
  9. public int slide = 0;
  10.  
  11. public void player(int valor) {
  12. index = index + valor;
  13. }
  14.  
  15.  
  16. public void previous()
  17. {
  18. slide--;
  19. chamar();
  20. }
  21.  
  22.  
  23. public void next()
  24. {
  25. slide++;
  26. chamar();
  27. }
  28.  
  29. void chamar()
  30. {
  31. if (slide <= 0)
  32. {
  33. slide = 0;
  34. }
  35.  
  36. if (slide >= 1)
  37. {
  38. slide = 1;
  39. }
  40.  
  41. if (slide == 0)
  42. {
  43. this.transform.position = Vector3.Lerp (this.transform.position, Myposic1[index], Time.deltaTime*time);
  44. if (index == Myposic1.Length - 1)
  45. right.interactable = false;
  46. else
  47. right.interactable = true;
  48.  
  49. if (index == 0)
  50. left.interactable = false;
  51. else
  52. left.interactable = true;
  53. Debug.Log("1posic");
  54. }
  55.  
  56. if (slide == 1)
  57. {
  58. this.transform.position = Vector3.Lerp (this.transform.position, Myposic2 [index], Time.deltaTime*time);
  59. if (index == Myposic2.Length - 1)
  60. right.interactable = false;
  61. else
  62. right.interactable = true;
  63.  
  64. if (index == 0)
  65. left.interactable = false;
  66. else
  67. left.interactable = true;
  68. Debug.Log("2posic");
  69. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement