123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class FxManagerAdon : MonoBehaviour
- {
- /// <summary>
- /// 攻击释放特效数组
- /// </summary>
- public Transform[] m_AttackEff;
- /// <summary>
- /// 攻击弹道特效数组
- /// </summary>
- public Transform[] m_TrajectEff;
- /// <summary>
- /// 攻击爆炸特效数组
- /// </summary>
- public Transform[] m_BombEff;
- /// <summary>
- /// 被击特效数组
- /// </summary>
- public Transform[] m_AttackedEff;
- /// <summary>
- /// 极限闪避提示光效
- /// </summary>
- public Transform m_ExtermePointEff;
- /// <summary>
- /// 死亡光效
- /// </summary>
- public Transform[] m_DieEffs;
- /// <summary>
- /// 眩晕光效
- /// </summary>
- public Transform m_DizzEff;
- // Start is called before the first frame update
- private void Awake()
- {
- //获取攻击特效对象
- Transform OBJ = transform.Find("FBX/Effect_000/Attacks");
- if(OBJ)
- {
- m_AttackEff = new Transform[OBJ.childCount];
- for (int i = 0; i < OBJ.childCount; i++)
- {
- m_AttackEff[i] = OBJ.GetChild(i);
- m_AttackEff[i].gameObject.SetActive(false);
- }
- }
-
- //获取弹道特效对象
- OBJ = transform.Find("FBX/Effect_000/Traject");
- if (OBJ)
- {
- m_TrajectEff = new Transform[OBJ.childCount];
- for (int i = 0; i < OBJ.childCount; i++)
- {
- m_TrajectEff[i] = OBJ.GetChild(i);
- m_TrajectEff[i].gameObject.SetActive(false);
- }
- }
-
- //获取爆炸特效对象
- OBJ = transform.Find("FBX/Effect_000/Bomb");
- if(OBJ)
- {
- m_BombEff = new Transform[OBJ.childCount];
- for (int i = 0; i < OBJ.childCount; i++)
- {
- m_BombEff[i] = OBJ.GetChild(i);
- m_BombEff[i].gameObject.SetActive(false);
- }
- }
-
- //获取被击特效对象
- OBJ = transform.Find("FBX/Effect_000/Attackeds");
- if(OBJ)
- {
- m_AttackedEff = new Transform[OBJ.childCount];
- for (int i = 0; i < OBJ.childCount; i++)
- {
- m_AttackedEff[i] = OBJ.GetChild(i);
- m_AttackedEff[i].gameObject.SetActive(false);
- }
- }
-
- //获取死亡特效对象
- OBJ = transform.Find("FBX/Effect_000/Die");
- if(OBJ)
- {
- m_DieEffs = new Transform[OBJ.childCount];
- for (int i = 0; i < OBJ.childCount; i++)
- {
- m_DieEffs[i] = OBJ.GetChild(i);
- m_DieEffs[i].gameObject.SetActive(false);
- }
- }
-
- m_DizzEff = transform.Find("FBX/Effect_ZhongXin/buff_801028");
- m_ExtermePointEff = transform.Find("FBX/Effect_000/ExtermePointEff");
- if(m_ExtermePointEff != null) m_ExtermePointEff.gameObject.SetActive(false);
- }
- void Start()
- {
-
- }
- /// <summary>
- /// 播放攻击特效
- /// </summary>
- /// <returns>特效对象.</returns>
- /// <param name="effId">特效id.</param>
- /// <param name="position">特效位置.</param>
- /// <param name="dir">角度.</param>
- /// <param name="lifeTimeMax">生命周期.</param>
- /// <param name="effT">特效类型.</param>
- public GameObject PlayAttackEff(int effId,bool bFollowing = false,Transform effParent = null)
- {
- GameObject effObj = m_AttackEff[effId].gameObject;//发出特效
- effObj.SetActive(true);//启用
- if (bFollowing)//跟随
- {
- effObj.transform.parent = effParent;
- }
- return effObj;
- }
- public void StopAttackEff(int effId)
- {
- GameObject effObj = m_AttackEff[effId].gameObject;//发出特效
- effObj.SetActive(false);//发送启用事件
- }
- /// <summary>
- /// 播放受击特效
- /// </summary>
- /// <returns>特效对象.</returns>
- /// <param name="effId">特效id.</param>
- /// <param name="position">特效位置.</param>
- /// <param name="dir">角度.</param>
- /// <param name="lifeTimeMax">生命周期.</param>
- /// <param name="effT">特效类型.</param>
- public GameObject PlayAttackedEff(int effId, bool bFollowing = false, Transform effParent = null)
- {
- if(m_AttackedEff == null)
- {
- return null;
- }
- //发出特效
- GameObject effObj = Instantiate(m_AttackedEff[effId].gameObject);
- effObj.SetActive(true);//发送启用事件
- if (bFollowing)//跟随
- {
- effObj.transform.parent = effParent;
- effObj.transform.localPosition = Vector3.zero;
- }
- return effObj;
- }
- /// <summary>
- /// 播放死亡特效
- /// </summary>
- /// <returns>特效对象.</returns>
- /// <param name="effId">特效id.</param>
- /// <param name="position">特效位置.</param>
- /// <param name="dir">角度.</param>
- /// <param name="lifeTimeMax">生命周期.</param>
- /// <param name="effT">特效类型.</param>
- public GameObject PlayDieEff(int effId, bool bFollowing = false, Transform effParent = null)
- {
- //发出特效
- GameObject effObj = Instantiate(m_DieEffs[effId].gameObject);
- effObj.SetActive(true);//发送启用事件
- if (bFollowing)//跟随
- {
- effObj.transform.parent = effParent;
- effObj.transform.localPosition = Vector3.zero;
- }
- else
- {
- effObj.transform.position = effParent.position;
- }
- return effObj;
- }
- public void StopAttackedEff(int effId)
- {
- GameObject effObj = m_AttackEff[effId].gameObject;//发出特效
- effObj.SetActive(false);//发送启用事件
- }
- /// <summary>
- /// 播放极限闪避提示特效
- /// </summary>
- public void PlayExtermePointEff()
- {
- m_ExtermePointEff.gameObject.SetActive(false);
- m_ExtermePointEff.gameObject.SetActive(true);//发送启用
- //StartCoroutine(playExtermePointEff());
-
- }
-
- }
|