FanFlyingSwords.cs 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. using Sirenix.OdinInspector;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using UnityEngine;
  5. public class FanFlyingSwords : MonoBehaviour
  6. {
  7. public GameObject sword;
  8. public PlayerController owner;
  9. public float angleRange;
  10. public float arrivalAngle;
  11. public int swordsNum;
  12. public int damage;
  13. [LabelText("»÷´òÖµ")] public int attackValue;
  14. public void Biu()
  15. {
  16. float angleInterval = angleRange / (float)(swordsNum - 1);
  17. for (int i = 0; i < swordsNum; i++)
  18. {
  19. float angle = 0;
  20. GameObject obj = PoolManager.Instantiate(sword);
  21. Vector3 dir = Vector3.zero;
  22. if(owner.bodyTrans.localScale.x > 0)
  23. {
  24. angle = 180 - arrivalAngle - angleRange/2 + i * angleInterval;
  25. }
  26. else
  27. {
  28. angle = arrivalAngle -angleRange / 2 + i * angleInterval;
  29. }
  30. angle = angle / 180 * Mathf.PI;
  31. dir = new Vector3(Mathf.Cos(angle), Mathf.Sin(angle), 0);
  32. AttackController.AttackMethod attackMethod = owner.attackController.curAttackMethod;
  33. attackMethod.attackInfo.damage = damage;
  34. attackMethod.attackInfo.attackValue = attackValue;
  35. obj.GetComponent<Bullet>().BeShoot(owner, owner.transform.position + Vector3.up, dir, false, attackMethod: attackMethod);
  36. }
  37. }
  38. }