123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105 |
- using Adon.Game.BO;
- using Adon.Game.Helper;
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- namespace AdonGameKit
- {
- /// <summary>
- /// 言灵法阵爆炸
- /// </summary>
- public class YLMagicCircleBomb : MonoBehaviour
- {
- /// <summary>
- /// 爆炸范围
- /// </summary>
- public float m_AttackSight = 3;
- /// <summary>
- /// 爆炸角度
- /// </summary>
- public float m_AttackAngle = 360;
- public BaseYLPartAdon m_YL;//释放者挂件(言灵)
- public BaseHero m_Hero;
- public Transform m_BombEff;
- public float m_FireTimeMax = 1;
- public string m_CurUseSkill;
- float fireTime;
- bool isFire;
- void Awake()
- {
- fireTime = m_FireTimeMax;
- }
- // Start is called before the first frame update
- void Start()
- {
- gameObject.GetComponentInChildren<FBXEventYL>().SetOwner(this.gameObject);
- }
- private void Update()
- {
- if (isFire)
- {
- //计时,周期发送伤害
- if (fireTime >= m_FireTimeMax)
- {
- fireTime = 0;
- ///检测范围内的怪
- List<GameObject> monsters = PlayerHelperAdon.GetNearMonsters(m_AttackSight, m_AttackAngle, gameObject);
- for (int i = 0; i < monsters.Count; i++)
- {
- BaseMonsterAdon monster = monsters[i].GetComponent<BaseMonsterAdon>();
- //X2Battle.X2BattleManager.Instance.mBulletModel.OnCastSkill(
- // m_Hero.mData.UID, m_CurUseSkill,
- // false, m_YL.M_YLType, monster.mData.UID, false);
- BulletMessage.catSkillFun(m_Hero.mData.UID, m_CurUseSkill,
- false, (int)m_YL.M_YLType, monster.mData.UID, false);
- //实例化克隆爆炸光效
- Transform effobj = Instantiate(m_BombEff);
- effobj.position = monster.m_HitObj.position;//设置爆炸位置
- effobj.gameObject.SetActive(true);
- effobj.gameObject.AddComponent<DestroyObjectDelayed>();
- }
- }
- fireTime += Time.deltaTime;
- }
-
- }
- public void SetHero(BaseHero _hero)
- {
- m_Hero = _hero;
- }
- public void SetBombEff(Transform _bombEff)
- {
- m_BombEff = _bombEff;
- }
- /// <summary>
- /// 攻击触发
- /// </summary>
- /// <param name="attackId">子连击id</param>
- public void OnAttackOn(string attackId)
- {
- isFire = true;
- }
- public void OnAttackOff()
- {
- isFire = false;
- }
- #if UNITY_EDITOR
- /// <summary>
- /// 绘制打击配置
- /// </summary>
- private void OnDrawGizmosSelected()
- {
- Vector3 forward = transform.forward;
- UnityEditor.Handles.color = new Color(1.0f, 0.0f, 0.0f, 0.1f);
- Vector3 rotatedForward = Quaternion.Euler(0, -m_AttackAngle * 0.5f, 0) * transform.forward;
- UnityEditor.Handles.DrawSolidArc(transform.position, Vector3.up, rotatedForward, m_AttackAngle, m_AttackSight);
- }
- #endif
- }
- }
|