123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 |
- using Adon.Game.BO;
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- namespace AdonGameKit
- {
- /// <summary>
- /// boss子弹(boss2麻痹弹)
- /// </summary>
- public class BossBulletAdon : MonoBehaviour
- {
- /// <summary>
- /// 子弹步进速度
- /// </summary>
- public float velocity = 300f;
- /// <summary>
- /// 生命周期
- /// </summary>
- public float lifeTime = 5f;
- float timer = 0f; // 子弹生命周期计时
- public BaseMonsterAdon m_BaseMonsterAdon;
- public void SetMonster(BaseMonsterAdon monster)
- {
- m_BaseMonsterAdon = monster;
- }
- void Awake()
- {
- }
- // Start is called before the first frame update
- void Start()
- {
-
- }
- void FixedUpdate()
- {
- Vector3 step = transform.forward * Time.deltaTime * velocity;//子弹步进
- // 生命周期到了则销毁
- if (timer >= lifeTime)
- OnProjectileDestroy();
- transform.position += step;//向前步进
- timer += Time.deltaTime;
- }
- /// <summary>
- /// 子弹销毁
- /// </summary>
- void OnProjectileDestroy()
- {
- //销毁,后期改为对象池
- Destroy(this.gameObject);
-
- }
- /// <summary>
- /// 武器技能触发事件
- /// </summary>
- /// <param name="collision"></param>
- void OnTriggerEnter(Collider collision)
- {
- if (collision.gameObject.layer == LayerMask.NameToLayer("Player"))//玩家层
- {
- Debug.Log("碰撞敌人");
- // //Debug.Log("OnTriggerEnter:" + collision.gameObject.name);
- BaseHero component = collision.gameObject.GetComponent<BaseHero>();
- //发送战斗信息,等待后台处理逻辑返回数据
- //X2Battle.X2BattleManager.Instance.mBulletModel.OnCastSkill(
- // m_BaseMonsterAdon.mData.UID, m_BaseMonsterAdon.mData.GetSKillNormal(m_BaseMonsterAdon.m_SkillId, m_BaseMonsterAdon.m_CurAttackIdx),
- // false, X2Battle.EBulletCastPoint.ECAST_POINT_DEFLUAT, component.mData.UID, false);
- BulletMessage.catSkillFun(m_BaseMonsterAdon.mData.UID, m_BaseMonsterAdon.mData.GetSKillNormal(m_BaseMonsterAdon.m_SkillId, m_BaseMonsterAdon.m_CurAttackIdx),
- false, (int)X2Battle.EBulletCastPoint.ECAST_POINT_DEFLUAT, component.mData.UID, false);
- }
- }
- }
- }
|