/// <summary> /// 从对象池中取出技能预警投射器的对象 by吴江 /// </summary> /// <param name="_pos"></param> /// <param name="_rot"></param> /// <returns></returns> public AbilityShadowEffecter SpawnAbilityShadowEffecter(Vector3 _pos, float _rotY, float _wid, float _length, AlertAreaType _type, Color _color, float _duration) { AbilityShadowEffecter abilityShadowEffecter = AbilityShadowEffectorPool.Request(_pos); abilityShadowEffecter.OnSpawned(_type, _color, _rotY, _wid, _length, _duration); return(abilityShadowEffecter); }
/// <summary> /// 从对象池中取出漂浮文字对象 by吴江 /// </summary> /// <param name="_pos"></param> /// <param name="_rot"></param> /// <returns></returns> public StateTexter SpawnStateTexter(AbilityResultInfo _info) { //if (!SystemSettingMng.ShowStateTexts) return null; StateTexter stateTexter = stateTexterPool.Request(); stateTexter.OnSpawned(_info); return(stateTexter); }
/// <summary> /// 从对象池中取出特效对象 因为没有进行预加载,因此只能采用异步回调的方式 by吴江 /// </summary> /// <param name="_pos"></param> /// <param name="_rot"></param> /// <returns></returns> public void SpawnEffecter(string _effectName, float _duration, System.Action <PoolEffecter> _callback, bool _matchingSpeed) { PoolEffecter defEffecter = null; exComponentPool <PoolEffecter> pool = null; if (defEffectPoolDictionary.TryGetValue(_effectName, out pool)) { //如果缓存中已经有这个对象池,那么直接回调结束 by吴江 defEffecter = pool.Request(); if (_callback != null) { _callback(defEffecter); } defEffecter.OnSpawned(_duration, _matchingSpeed); } else { //如果缓存中尚无这个对象池;那么看看请求队列中是否已经有,如果尚无请求,则新建请求。 如有请求,则把回调压入之前的请求中。 by吴江 CallKey callKey = new CallKey(_effectName, _duration, _callback); if (!waitCallBack.ContainsKey(_effectName)) { List <CallKey> list = new List <CallKey>(); list.Add(callKey); waitCallBack[_effectName] = list; BuildDefEffecterPool(_effectName, (x) => { if (x != null) { pool = x; defEffectPoolDictionary.Add(_effectName, pool); if (waitCallBack.ContainsKey(_effectName)) { int count = waitCallBack[_effectName].Count; for (int i = 0; i < count; i++) { defEffecter = pool.Request(); if (waitCallBack[_effectName][i].callBack != null) { waitCallBack[_effectName][i].callBack(defEffecter); } defEffecter.OnSpawned(_duration, _matchingSpeed); } waitCallBack.Remove(_effectName); } } }); } else { waitCallBack[_effectName].Add(callKey); } } }
/// <summary> /// 从对象池中取出弹道的对象 by吴江 /// </summary> /// <param name="_pos"></param> /// <param name="_rot"></param> /// <returns></returns> public AbilityBallisticCurve SpawnAbilityBallisticCurve(AbilityBallisticCurveInfo _info) { AbilityBallisticCurve abilityBallisticCurve = abilityBallisticCurvePool.Request(_info.StartPos, Quaternion.Euler(_info.Direction)); abilityBallisticCurve.OnSpawned(_info); return(abilityBallisticCurve); }
/// <summary> /// 从对象池中取出点击地面特效的对象 by吴江 /// </summary> /// <param name="_pos"></param> /// <param name="_rot"></param> /// <returns></returns> public Indicator SpawnIndicator(Vector3 _pos, Quaternion _rot) { Indicator indicator = indicatorPool.Request(_pos, _rot); if (indicator != null) { indicator.OnSpawned(); } return(indicator); }
/// <summary> /// 从对象池中取出 阴影投射器的对象 by吴江 /// </summary> /// <param name="_pos"></param> /// <param name="_rot"></param> /// <returns></returns> public ShadowEffecter SpawnShadowEffecter(Vector3 _pos, Quaternion _rot, Transform _parent) { ShadowEffecter shadowEffecter = shadowEffectorPool.Request(_pos, _rot, _parent); if (_parent != null) { shadowEffecter.gameObject.layer = _parent.gameObject.layer; } shadowEffecter.OnSpawned(); return(shadowEffecter); }
/// <summary> /// 从对象池中取出脚下光圈的对象 by吴江 /// </summary> /// <param name="_pos"></param> /// <param name="_rot"></param> /// <returns></returns> public RingEffecter SpawnRingEffecter(Vector3 _pos, Quaternion _rot, Transform _parent, Color _color) { RingEffecter ringEffecter = ringEffecterPool.Request(_pos, _rot, _parent); if (ringEffecter != null) { if (_parent != null) { ringEffecter.gameObject.layer = _parent.gameObject.layer; } ringEffecter.OnSpawned(_color); } return(ringEffecter); }
/// <summary> /// 从对象池中取出技能延迟特效的对象 by吴江 /// </summary> /// <param name="_pos"></param> /// <param name="_rot"></param> /// <returns></returns> public AbilityDelayEffectCtrl SpawnAbilityDelayEffectCtrl(AbilityDelayEffectRefData _delayData, Transform _userTransform) { if (_delayData == null || _userTransform == null) { if (_delayData == null) { Debug.LogError("技能延迟特效信息为空!"); } return(null); } float eulerAngleY = _userTransform.localEulerAngles.y; float x = Mathf.Sin(eulerAngleY * Mathf.Deg2Rad) * _delayData.diffPos.z + Mathf.Cos(eulerAngleY * Mathf.Deg2Rad) * _delayData.diffPos.x; float z = Mathf.Cos(eulerAngleY * Mathf.Deg2Rad) * _delayData.diffPos.z + Mathf.Sin(eulerAngleY * Mathf.Deg2Rad) * _delayData.diffPos.x; // Debug.logger.Log("eulerAngleY = " + eulerAngleY + " , Mathf.Sin(eulerAngleY * Mathf.Deg2Rad) = " + Mathf.Sin(eulerAngleY * Mathf.Deg2Rad) + " , Mathf.Cos(eulerAngleY * Mathf.Deg2Rad) = " + Mathf.Cos(eulerAngleY * Mathf.Deg2Rad)); Vector3 diffPos = new Vector3(x, _delayData.diffPos.y, z); Vector3 pos = diffPos + _userTransform.position; // Debug.logger.Log("玩家坐标" + _userTransform.position + " , 差异坐标" + diffPos + " , 最终坐标" + pos); AbilityDelayEffectCtrl abilityDelayEffectCtrl = abilityDelayEffectCtrlPool.Request(pos, _userTransform.rotation); abilityDelayEffectCtrl.OnSpawned(_delayData.effectName, _delayData.startTIme, _delayData.duration, pos); return(abilityDelayEffectCtrl); }