Trans_Invisible.cs 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using Spine.Unity;
  5. public class Trans_Invisible : MonoBehaviour
  6. {
  7. public Demonic demonic;
  8. [HideInInspector]
  9. public PlayerController player;
  10. //public float changeTime;
  11. public bool canInvincible;
  12. public float maxFlyHeight;
  13. public GameObject invisibleEffect;
  14. //public float addMp;
  15. //public InvisibleSoulCollector soulCollector;
  16. //public GameObject soulPrefab;
  17. //public float distance;
  18. //public Transform body;
  19. //public Transform shootPos;
  20. //public SoulFollowEffect soulFollowEffect;
  21. //public GameObject smokeEffect;
  22. //public float interval;
  23. //[HideInInspector]
  24. //public Vector3 lastSmokePos;
  25. //[HideInInspector]
  26. //public float time;
  27. //[HideInInspector]
  28. //public float normalSpeed;
  29. //public float KMp;
  30. //public float magnification;
  31. //public float firstScale;
  32. //public float addScaleMagnification;
  33. //public float boomTime;
  34. //public float addBoomTime;
  35. //public float maxBoomTime;
  36. //public float soulMagnification;
  37. private void Start()
  38. {
  39. player = transform.GetComponentInParent<PlayerController>();
  40. player.canFly = true;
  41. player.maxFlyHeight = maxFlyHeight;
  42. player.isInvisible = true;
  43. //playerController.changeTime = changeTime;
  44. //playerController.uiHp.gameObject.SetActive(false);
  45. //playerController.isInvisible = true;
  46. //playerController.mp += addMp;
  47. //if (playerController.floatState != 0)
  48. //{
  49. // playerController.floatState = 3;
  50. // player.transform.localEulerAngles = new Vector3(0, 0, 0);
  51. //}
  52. //normalSpeed = playerController.moveSpeed;
  53. //for (int i = 0;i < playerController.beTargetCharacter.Count; i++)
  54. //{
  55. // playerController.beTargetCharacter[i].targetCharacter = null;
  56. //}
  57. }
  58. private void Update()
  59. {
  60. if (player.isUltimate)
  61. {
  62. player.isUltimate = false;
  63. GameObject effect = Instantiate(invisibleEffect);
  64. effect.transform.position = transform.position;
  65. //player.EndTransfiguration(6);
  66. }
  67. }
  68. private void OnDisable()
  69. {
  70. player.canFly = false;
  71. }
  72. /*
  73. private void Update()
  74. {
  75. if (playerController.isinputJ)
  76. {
  77. playerController.isinputJ = false;
  78. if (soulCollector.soulNumbers > soulFollowEffect.boomSoulNumber)
  79. {
  80. soulCollector.soulNumbers--;
  81. soulFollowEffect.ShowSouls(soulCollector.soulNumbers);
  82. AttackJ();
  83. }
  84. else if(playerController.mp>= soulPrefab.GetComponent<Soul>().addMp* soulMagnification)
  85. {
  86. playerController.mp -= soulPrefab.GetComponent<Soul>().addMp * soulMagnification;
  87. AttackJ();
  88. }
  89. }
  90. if (playerController.isClickBtnEast)
  91. {
  92. time = 0;
  93. playerController.moveSpeed = normalSpeed * magnification;
  94. }
  95. if (playerController.isinputK)
  96. {
  97. time += Time.deltaTime;
  98. if (time > interval)
  99. {
  100. AttackK();
  101. }
  102. }
  103. else
  104. {
  105. playerController.moveSpeed = normalSpeed;
  106. }
  107. if (playerController.isinputL)
  108. {
  109. playerController.isinputL = false ;
  110. if ((!soulFollowEffect.isBoom || soulFollowEffect.KBoomSoulTime > 0 )
  111. &&soulCollector.soulNumbers > 0
  112. && soulCollector.soulNumbers>soulFollowEffect.boomSoulNumber)
  113. {
  114. AttackL();
  115. }
  116. }
  117. if (!playerController.isTransfiguration)
  118. {
  119. BackToPlayer();
  120. }
  121. }
  122. private void OnDisable()
  123. {
  124. BackToPlayer();
  125. }
  126. public void BackToPlayer()
  127. {
  128. playerController.ani.Play("fall",0,0);
  129. playerController.mp += soulCollector.soulNumbers * soulPrefab.GetComponent<Soul>().addMp;
  130. soulCollector.soulNumbers = 0;
  131. }
  132. void AttackJ()
  133. {
  134. GameObject soulObj = Instantiate(soulPrefab);
  135. Soul soul = soulObj.GetComponent<Soul>();
  136. soul.from = shootPos.transform.position;
  137. if (playerController.rb.velocity == Vector3.zero)
  138. {
  139. if (body.localScale.x > 0)
  140. {
  141. soul.to = transform.position + Vector3.left * distance;
  142. }
  143. else
  144. {
  145. soul.to = transform.position + Vector3.right * distance;
  146. }
  147. }
  148. else
  149. {
  150. soul.to = transform.position + playerController.rb.velocity.normalized * distance;
  151. }
  152. soul.isShoot = true;
  153. }
  154. void AttackK()
  155. {
  156. if(playerController.mp >= KMp)
  157. {
  158. playerController.mp -= KMp;
  159. GameObject smoke = Instantiate(smokeEffect);
  160. smoke.transform.position = transform.position;
  161. lastSmokePos = transform.position;
  162. time = 0;
  163. }
  164. }
  165. void AttackL()
  166. {
  167. if(soulFollowEffect.boomSoulNumber == 0)
  168. {
  169. soulFollowEffect.KBoomSoulTime = boomTime;
  170. }
  171. else
  172. {
  173. soulFollowEffect.KBoomSoulTime += addBoomTime;
  174. if(soulFollowEffect.KBoomSoulTime > maxBoomTime)
  175. {
  176. soulFollowEffect.KBoomSoulTime = maxBoomTime;
  177. }
  178. }
  179. soulFollowEffect.boomSoulNumber++;
  180. soulFollowEffect.boomScale =
  181. firstScale * Mathf.Pow(soulFollowEffect.boomSoulNumber, addScaleMagnification);
  182. soulFollowEffect.SoulChangeColor(soulFollowEffect.boomSoulNumber - 1,true);
  183. soulFollowEffect.isBooming = true;
  184. }
  185. */
  186. }