Trans_Invisible.cs 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  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. //playerController.changeTime = changeTime;
  43. //playerController.uiHp.gameObject.SetActive(false);
  44. //playerController.isInvisible = true;
  45. //playerController.mp += addMp;
  46. //if (playerController.floatState != 0)
  47. //{
  48. // playerController.floatState = 3;
  49. // player.transform.localEulerAngles = new Vector3(0, 0, 0);
  50. //}
  51. //normalSpeed = playerController.moveSpeed;
  52. //for (int i = 0;i < playerController.beTargetCharacter.Count; i++)
  53. //{
  54. // playerController.beTargetCharacter[i].targetCharacter = null;
  55. //}
  56. }
  57. private void Update()
  58. {
  59. if (player.isUltimate)
  60. {
  61. player.isUltimate = false;
  62. GameObject effect = Instantiate(invisibleEffect);
  63. effect.transform.position = transform.position;
  64. player.EndTransfiguration(6);
  65. }
  66. }
  67. /*
  68. private void Update()
  69. {
  70. if (playerController.isinputJ)
  71. {
  72. playerController.isinputJ = false;
  73. if (soulCollector.soulNumbers > soulFollowEffect.boomSoulNumber)
  74. {
  75. soulCollector.soulNumbers--;
  76. soulFollowEffect.ShowSouls(soulCollector.soulNumbers);
  77. AttackJ();
  78. }
  79. else if(playerController.mp>= soulPrefab.GetComponent<Soul>().addMp* soulMagnification)
  80. {
  81. playerController.mp -= soulPrefab.GetComponent<Soul>().addMp * soulMagnification;
  82. AttackJ();
  83. }
  84. }
  85. if (playerController.isClickBtnEast)
  86. {
  87. time = 0;
  88. playerController.moveSpeed = normalSpeed * magnification;
  89. }
  90. if (playerController.isinputK)
  91. {
  92. time += Time.deltaTime;
  93. if (time > interval)
  94. {
  95. AttackK();
  96. }
  97. }
  98. else
  99. {
  100. playerController.moveSpeed = normalSpeed;
  101. }
  102. if (playerController.isinputL)
  103. {
  104. playerController.isinputL = false ;
  105. if ((!soulFollowEffect.isBoom || soulFollowEffect.KBoomSoulTime > 0 )
  106. &&soulCollector.soulNumbers > 0
  107. && soulCollector.soulNumbers>soulFollowEffect.boomSoulNumber)
  108. {
  109. AttackL();
  110. }
  111. }
  112. if (!playerController.isTransfiguration)
  113. {
  114. BackToPlayer();
  115. }
  116. }
  117. private void OnDisable()
  118. {
  119. BackToPlayer();
  120. }
  121. public void BackToPlayer()
  122. {
  123. playerController.ani.Play("fall",0,0);
  124. playerController.mp += soulCollector.soulNumbers * soulPrefab.GetComponent<Soul>().addMp;
  125. soulCollector.soulNumbers = 0;
  126. }
  127. void AttackJ()
  128. {
  129. GameObject soulObj = Instantiate(soulPrefab);
  130. Soul soul = soulObj.GetComponent<Soul>();
  131. soul.from = shootPos.transform.position;
  132. if (playerController.rb.velocity == Vector3.zero)
  133. {
  134. if (body.localScale.x > 0)
  135. {
  136. soul.to = transform.position + Vector3.left * distance;
  137. }
  138. else
  139. {
  140. soul.to = transform.position + Vector3.right * distance;
  141. }
  142. }
  143. else
  144. {
  145. soul.to = transform.position + playerController.rb.velocity.normalized * distance;
  146. }
  147. soul.isShoot = true;
  148. }
  149. void AttackK()
  150. {
  151. if(playerController.mp >= KMp)
  152. {
  153. playerController.mp -= KMp;
  154. GameObject smoke = Instantiate(smokeEffect);
  155. smoke.transform.position = transform.position;
  156. lastSmokePos = transform.position;
  157. time = 0;
  158. }
  159. }
  160. void AttackL()
  161. {
  162. if(soulFollowEffect.boomSoulNumber == 0)
  163. {
  164. soulFollowEffect.KBoomSoulTime = boomTime;
  165. }
  166. else
  167. {
  168. soulFollowEffect.KBoomSoulTime += addBoomTime;
  169. if(soulFollowEffect.KBoomSoulTime > maxBoomTime)
  170. {
  171. soulFollowEffect.KBoomSoulTime = maxBoomTime;
  172. }
  173. }
  174. soulFollowEffect.boomSoulNumber++;
  175. soulFollowEffect.boomScale =
  176. firstScale * Mathf.Pow(soulFollowEffect.boomSoulNumber, addScaleMagnification);
  177. soulFollowEffect.SoulChangeColor(soulFollowEffect.boomSoulNumber - 1,true);
  178. soulFollowEffect.isBooming = true;
  179. }
  180. */
  181. }