Trans_Invisible.cs 5.3 KB

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