MateuszGrabarczyk

ANI LAB

Mar 13th, 2023
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.00 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4.  
  5. public class AppCtrl : MonoBehaviour {
  6.  
  7. public GameObject girlCharacter;
  8.  
  9.  
  10. private GameObject Lleg,Rleg,Llydka,Rlydka;
  11.  
  12. private int klatka;
  13.  
  14. private float mouse_dostance_x;
  15.  
  16. void Start () {
  17. Debug.Log("start");
  18.  
  19. klatka = 1;
  20.  
  21. GameObject mArm;
  22. mArm = GameObject.Find("unitychan/Character1_Reference/Character1_Hips/Character1_Spine/Character1_Spine1/Character1_Spine2/Character1_LeftShoulder/Character1_LeftArm");// ("Character1_LeftArm");
  23. mArm.transform.Rotate(0,75,0);
  24. mArm = GameObject.Find("unitychan/Character1_Reference/Character1_Hips/Character1_Spine/Character1_Spine1/Character1_Spine2/Character1_RightShoulder/Character1_RightArm");// ("Character1_LeftArm");
  25. mArm.transform.Rotate(0, -75, 0);
  26.  
  27. string nazwa = "unitychan/Character1_Reference/Character1_Hips/Character1_RightUpLeg";
  28.  
  29. nazwa = "unitychan/Character1_Reference/Character1_Hips/Character1_LeftUpLeg";
  30. Lleg = GameObject.Find(nazwa);
  31. string nazwa1 = "unitychan/Character1_Reference/Character1_Hips/Character1_RightUpLeg";
  32. Rleg = GameObject.Find(nazwa1);
  33. string nazwa2 = "unitychan/Character1_Reference/Character1_Hips/Character1_LeftUpLeg/Character1_LeftLeg";
  34. Llydka = GameObject.Find(nazwa2);
  35. string nazwa3 = "unitychan/Character1_Reference/Character1_Hips/Character1_RightUpLeg/Character1_RightLeg";
  36. Rlydka = GameObject.Find(nazwa3);
  37.  
  38. }
  39.  
  40.  
  41. Vector2 pos;
  42.  
  43. void Rotatecam()
  44. {
  45. float Sensitivity = 0.2f;
  46. if (Input.GetMouseButtonDown(0))
  47. {
  48. pos = Input.mousePosition;
  49. }
  50. if (Input.GetMouseButton(0))
  51. {
  52. transform.localEulerAngles += new Vector3((Input.mousePosition.y - pos.y) * Sensitivity, (-Input.mousePosition.x + pos.x) * Sensitivity, 0);
  53. pos = Input.mousePosition;
  54. }
  55.  
  56.  
  57. if (Input.GetMouseButtonDown(1))
  58. {
  59. pos = Input.mousePosition;
  60. }
  61. if (Input.GetMouseButton(1))
  62. {
  63. Sensitivity = 0.02f;
  64. transform.Translate((Input.mousePosition.x - pos.x) * Sensitivity,0.0f, (Input.mousePosition.y - pos.y) * Sensitivity);
  65. pos = Input.mousePosition;
  66. }
  67.  
  68. }
  69.  
  70. // Update is called once per frame
  71. void Update () {
  72. klatka++;
  73. Rotatecam();
  74.  
  75. if (klatka < 90)
  76. {
  77. Lleg.transform.Rotate(0, 0, -0.5f);
  78. Llydka.transform.Rotate(0, 0, 0.5f);
  79. if (klatka>30)
  80. girlCharacter.transform.Translate(0.0f, 0.01f, 0.0f);
  81. Rleg.transform.Rotate(0, 0, 0.25f);
  82. }
  83. if (klatka>=90 && klatka < 180 )
  84. {
  85. Rleg.transform.Rotate(0, 0, -0.75f);
  86. Rlydka.transform.Rotate(0, 0, 0.5f);
  87. if (klatka > 120)
  88. girlCharacter.transform.Translate(0.0f, 0.01f, 0.0f);
  89. Lleg.transform.Rotate(0, 0, 0.75f);
  90. Llydka.transform.Rotate(0, 0, -0.5f);
  91. }
  92. if (klatka >= 180 && klatka < 270)
  93. {
  94. Lleg.transform.Rotate(0, 0, -1);
  95. Llydka.transform.Rotate(0, 0, 0.5f);
  96. if (klatka > 210)
  97. girlCharacter.transform.Translate(0.0f, 0.01f, 0.0f);
  98. Rleg.transform.Rotate(0, 0, 0.75f);
  99. Rlydka.transform.Rotate(0, 0, -0.5f);
  100. }
  101. if (klatka >= 270 && klatka < 360)
  102. {
  103. Rleg.transform.Rotate(0, 0, -0.75f);
  104. Rlydka.transform.Rotate(0, 0, 0.5f);
  105. if (klatka > 300)
  106. girlCharacter.transform.Translate(0.0f, 0.01f, 0.0f);
  107. Lleg.transform.Rotate(0, 0, 1);
  108. Llydka.transform.Rotate(0, 0, -0.5f);
  109.  
  110. Rleg.transform.Rotate(0, 0, 0.5f);
  111. Rlydka.transform.Rotate(0, 0, -0.5f);
  112. Lleg.transform.Rotate(0, 0, -0.25f);
  113. //Llydka.transform.Rotate(0, 0, 0.5f);
  114.  
  115. }
  116. }
  117. }
Add Comment
Please, Sign In to add comment