Guest User

Untitled

a guest
Sep 9th, 2019
614
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.85 KB | None | 0 0
  1. else if (Input.GetAxis("Horizontal") > 0.5f || Input.GetAxis("Horizontal") < -0.5f || Input.GetAxis("DpadX") > 0.5f || Input.GetAxis("DpadX") < -0.5f || Input.GetKey(KeyCode.RightArrow) || Input.GetKey(KeyCode.LeftArrow))
  2. {
  3. this.CalculateValue();
  4. Material material = this.Student.Cosmetic.HairRenderer.material;
  5. Material material2 = this.Student.Cosmetic.RightEyeRenderer.material;
  6. if (this.Selected == 4)
  7. {
  8. material.color = new Color(material.color.r + (float)this.Degree * 0.003921569f * (float)this.Value, material.color.g, material.color.b, material.color.a);
  9. }
  10. else if (this.Selected == 5)
  11. {
  12. material.color = new Color(material.color.r, material.color.g + (float)this.Degree * 0.003921569f * (float)this.Value, material.color.b, material.color.a);
  13. }
  14. else if (this.Selected == 6)
  15. {
  16. material.color = new Color(material.color.r, material.color.g, material.color.b + (float)this.Degree * 0.003921569f * (float)this.Value, material.color.a);
  17. }
  18. else if (this.Selected == 7)
  19. {
  20. material2.color = new Color(material2.color.r + (float)this.Degree * 0.003921569f * (float)this.Value, material2.color.g, material2.color.b, material2.color.a);
  21. }
  22. else if (this.Selected == 8)
  23. {
  24. material2.color = new Color(material2.color.r, material2.color.g + (float)this.Degree * 0.003921569f * (float)this.Value, material2.color.b, material2.color.a);
  25. }
  26. else if (this.Selected == 9)
  27. {
  28. material2.color = new Color(material2.color.r, material2.color.g, material2.color.b + (float)this.Degree * 0.003921569f * (float)this.Value, material2.color.a);
  29. }
  30.  
  31. this.CapColors();
  32. this.UpdateLabels();
  33. }
  34.  
  35. private void CapColors()
  36. {
  37. Material material = this.Student.Cosmetic.HairRenderer.material;
  38. if (material.color.r < 0f)
  39. {
  40. material.color = new Color(0f, material.color.g, material.color.b, material.color.a);
  41. }
  42. if (material.color.g < 0f)
  43. {
  44. material.color = new Color(material.color.r, 0f, material.color.b, material.color.a);
  45. }
  46. if (material.color.b < 0f)
  47. {
  48. material.color = new Color(material.color.r, material.color.g, 0f, material.color.a);
  49. }
  50. if (material.color.r > 1f)
  51. {
  52. material.color = new Color(1f, material.color.g, material.color.b, material.color.a);
  53. }
  54. if (material.color.g > 1f)
  55. {
  56. material.color = new Color(material.color.r, 1f, material.color.b, material.color.a);
  57. }
  58. if (material.color.b > 1f)
  59. {
  60. material.color = new Color(material.color.r, material.color.g, 1f, material.color.a);
  61. }
  62.  
  63. Material material2 = this.Student.Cosmetic.RightEyeRenderer.material;
  64. if (material2.color.r < 0f)
  65. {
  66. material2.color = new Color(0f, material2.color.g, material2.color.b, material2.color.a);
  67. }
  68. if (material2.color.g < 0f)
  69. {
  70. material2.color = new Color(material2.color.r, 0f, material2.color.b, material2.color.a);
  71. }
  72. if (material2.color.b < 0f)
  73. {
  74. material2.color = new Color(material2.color.r, material2.color.g, 0f, material2.color.a);
  75. }
  76. if (material2.color.r > 1f)
  77. {
  78. material2.color = new Color(1f, material2.color.g, material2.color.b, material2.color.a);
  79. }
  80. if (material2.color.g > 1f)
  81. {
  82. material2.color = new Color(material2.color.r, 1f, material2.color.b, material2.color.a);
  83. }
  84. if (material2.color.b > 1f)
  85. {
  86. material2.color = new Color(material2.color.r, material2.color.g, 1f, material2.color.a);
  87. }
  88. this.Student.Cosmetic.LeftEyeRenderer.material.color = material2.color;
  89. }
  90.  
  91. private void CalculateValue()
  92. {
  93. if (Input.GetAxis("Horizontal") > 0.5f || Input.GetAxis("Horizontal") < -0.5f)
  94. {
  95. if (Input.GetAxis("Horizontal") > 0.5f)
  96. {
  97. this.Value = 1;
  98. }
  99. else
  100. {
  101. this.Value = -1;
  102. }
  103. }
  104. else if (Input.GetAxis("DpadX") > 0.5f || Input.GetAxis("DpadX") < -0.5f)
  105. {
  106. if (Input.GetAxis("DpadX") > 0.5f)
  107. {
  108. this.Value = 1;
  109. }
  110. else
  111. {
  112. this.Value = -1;
  113. }
  114. }
  115. else
  116. {
  117. this.Value = ((!Input.GetKey(KeyCode.RightArrow)) ? -1 : 1);
  118. }
  119. }
Add Comment
Please, Sign In to add comment