using Adon.Game.BO;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace AdonGameKit
{
///
/// boss子弹(boss2麻痹弹)
///
public class BossBulletAdon : MonoBehaviour
{
///
/// 子弹步进速度
///
public float velocity = 300f;
///
/// 生命周期
///
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;
}
///
/// 子弹销毁
///
void OnProjectileDestroy()
{
//销毁,后期改为对象池
Destroy(this.gameObject);
}
///
/// 武器技能触发事件
///
///
void OnTriggerEnter(Collider collision)
{
if (collision.gameObject.layer == LayerMask.NameToLayer("Player"))//玩家层
{
Debug.Log("碰撞敌人");
// //Debug.Log("OnTriggerEnter:" + collision.gameObject.name);
BaseHero component = collision.gameObject.GetComponent();
//发送战斗信息,等待后台处理逻辑返回数据
//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);
}
}
}
}