SkillControlOpr.cs 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. using UnityEngine;
  2. using System.Collections;
  3. namespace YLBattle
  4. {
  5. /// <summary>
  6. /// 技能释放(子弹生成)
  7. /// </summary>
  8. public partial class SkillControl : MonoBehaviour
  9. {
  10. /// <summary>
  11. /// 子弹创建
  12. /// </summary>
  13. /// <param name="uid">子弹隶属对象编号</param>
  14. /// <param name="id">实例ID</param>
  15. /// <param name="tid">模板ID</param>
  16. public void BulletLoad(BulletLoadParam param)
  17. {
  18. createProjectile(param);
  19. }
  20. /// <summary>
  21. /// 检测指定子弹是否创建完成
  22. /// </summary>
  23. /// <param name="id">子弹编号</param>
  24. /// <returns>true创建成功, false创建失败</returns>
  25. public bool BulletLoadComplete(string id)
  26. {
  27. return ProjectileBases.ContainsKey(id);
  28. }
  29. /// <summary>
  30. /// 子弹发射.
  31. /// </summary>
  32. /// <param name="id">子弹唯一标示符</param>
  33. /// <param name="type">子弹位置目标类型</param>
  34. /// <param name="param">子弹目标参数(目标ID)</param>
  35. public void BulletLaunch(string id, EBulletTargeType type, object param)
  36. {
  37. ///目标型子弹
  38. string targetID = param as string;
  39. /**
  40. * 打击指定目标角色 type=1;
  41. */
  42. Fighter target = FightingManager.Instance.GetFighter(targetID);//获取目标对象
  43. if (target == null && type == EBulletTargeType.EBULLET_TARGET_FIGHTER)
  44. {
  45. LogHelper.LogError("BulletLaunch.targetId=" + targetID + " 未找到指定目标");
  46. return;
  47. }
  48. Vector3 targetPos = Vector3.zero;
  49. ProjectileBase _bulletData = null;
  50. if (type == EBulletTargeType.EBULLET_TARGET_FIGHTER)
  51. {
  52. ///根据id获取子弹对象
  53. if (ProjectileBases.ContainsKey(id))
  54. {
  55. _bulletData = ProjectileBases[id];
  56. switch (_bulletData.bulletLoadParam.hitpoint)
  57. {
  58. case EBulletHitPointType.EBULLET_HITPOINT_NORMAL:
  59. targetPos = target.mBodyCenterPos;
  60. break;
  61. case EBulletHitPointType.EBULLET_HITPOINT_DOWN:
  62. targetPos = target.mBodyRootPos;
  63. break;
  64. }
  65. }
  66. }
  67. /**
  68. * aimparm!=0
  69. */
  70. switch (type)
  71. {
  72. case EBulletTargeType.EBULLET_TARGET_FIGHTER:
  73. createSkillShoot(id, targetPos, targetID, false, (int)type);
  74. break;
  75. case EBulletTargeType.EBULLET_TARGET_MAP:
  76. if (_bulletData != null)
  77. {
  78. if (_bulletData.bulletLoadParam.team == EBattleTeam.BLUETEAM)
  79. {
  80. targetPos = this.mUICenter;
  81. }
  82. else
  83. {
  84. targetPos = WorldToGUI(FightingMap.Instance.MapPos);
  85. }
  86. }
  87. createSkillShoot(id, targetPos, targetID, true, (int)type);
  88. break;
  89. case EBulletTargeType.EBULLET_TARGET_SCREEN:
  90. if (_bulletData != null)
  91. {
  92. if (_bulletData.bulletLoadParam.team == EBattleTeam.BLUETEAM)
  93. {
  94. targetPos = this.mUICenter;
  95. }
  96. else
  97. {
  98. targetPos = this.mMapCenter;
  99. }
  100. }
  101. createSkillShoot(id, targetPos, targetID, true, (int)type);
  102. break;
  103. case EBulletTargeType.EBULLET_TARGET_Center:
  104. createSkillShoot(id, Vector3.zero, targetID, true, (int)type);
  105. break;
  106. }
  107. }
  108. }
  109. }