123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126 |
- using UnityEngine;
- using System.Collections;
- namespace YLBattle
- {
- /// <summary>
- /// 技能释放(子弹生成)
- /// </summary>
- public partial class SkillControl : MonoBehaviour
- {
- /// <summary>
- /// 子弹创建
- /// </summary>
- /// <param name="uid">子弹隶属对象编号</param>
- /// <param name="id">实例ID</param>
- /// <param name="tid">模板ID</param>
- public void BulletLoad(BulletLoadParam param)
- {
- createProjectile(param);
- }
- /// <summary>
- /// 检测指定子弹是否创建完成
- /// </summary>
- /// <param name="id">子弹编号</param>
- /// <returns>true创建成功, false创建失败</returns>
- public bool BulletLoadComplete(string id)
- {
- return ProjectileBases.ContainsKey(id);
- }
- /// <summary>
- /// 子弹发射.
- /// </summary>
- /// <param name="id">子弹唯一标示符</param>
- /// <param name="type">子弹位置目标类型</param>
- /// <param name="param">子弹目标参数(目标ID)</param>
- public void BulletLaunch(string id, EBulletTargeType type, object param)
- {
- ///目标型子弹
- string targetID = param as string;
- /**
- * 打击指定目标角色 type=1;
- */
- Fighter target = FightingManager.Instance.GetFighter(targetID);//获取目标对象
- if (target == null && type == EBulletTargeType.EBULLET_TARGET_FIGHTER)
- {
- LogHelper.LogError("BulletLaunch.targetId=" + targetID + " 未找到指定目标");
- return;
- }
- Vector3 targetPos = Vector3.zero;
- ProjectileBase _bulletData = null;
- if (type == EBulletTargeType.EBULLET_TARGET_FIGHTER)
- {
- ///根据id获取子弹对象
- if (ProjectileBases.ContainsKey(id))
- {
- _bulletData = ProjectileBases[id];
- switch (_bulletData.bulletLoadParam.hitpoint)
- {
- case EBulletHitPointType.EBULLET_HITPOINT_NORMAL:
- targetPos = target.mBodyCenterPos;
- break;
- case EBulletHitPointType.EBULLET_HITPOINT_DOWN:
- targetPos = target.mBodyRootPos;
- break;
- }
- }
- }
- /**
- * aimparm!=0
- */
- switch (type)
- {
- case EBulletTargeType.EBULLET_TARGET_FIGHTER:
- createSkillShoot(id, targetPos, targetID, false, (int)type);
- break;
- case EBulletTargeType.EBULLET_TARGET_MAP:
- if (_bulletData != null)
- {
- if (_bulletData.bulletLoadParam.team == EBattleTeam.BLUETEAM)
- {
- targetPos = this.mUICenter;
- }
- else
- {
- targetPos = WorldToGUI(FightingMap.Instance.MapPos);
- }
- }
- createSkillShoot(id, targetPos, targetID, true, (int)type);
- break;
- case EBulletTargeType.EBULLET_TARGET_SCREEN:
- if (_bulletData != null)
- {
- if (_bulletData.bulletLoadParam.team == EBattleTeam.BLUETEAM)
- {
- targetPos = this.mUICenter;
- }
- else
- {
- targetPos = this.mMapCenter;
- }
- }
- createSkillShoot(id, targetPos, targetID, true, (int)type);
- break;
- case EBulletTargeType.EBULLET_TARGET_Center:
- createSkillShoot(id, Vector3.zero, targetID, true, (int)type);
- break;
- }
- }
- }
- }
|