コード例 #1
0
        public void HandleNormalEffect(EffectCom effectCom)
        {
            Entity        entity     = LCECS.ECSLocate.ECS.GetEntity(effectCom.EntityId);
            GameObjectCom goCom      = entity.GetCom <GameObjectCom>();
            Transform     entityTran = goCom.Tran;

            //获得特效节点
            EffectInfo info     = null;
            EffectGo   effectGo = GetEffectGo(effectCom, effectCom.CurrShowEffectId, ref info);

            //设置位置
            effectGo.Go.transform.position = entityTran.position + effectCom.ShowPos;
            effectGo.Go.SetActive(true);
        }
コード例 #2
0
 //将特效加入缓存
 public void PushEffectGoInCache(EffectCom effectCom, int effectId, EffectGo effectGo)
 {
     effectGo.Go.SetActive(false);
     if (effectCom.CacheEffects.ContainsKey(effectId))
     {
         effectCom.CacheEffects[effectId].EffectGos.Add(effectGo);
     }
     else
     {
         EffectData effectData = new EffectData();
         effectData.Info = GetEffectInfo(effectId);
         effectData.EffectGos.Add(effectGo);
         effectCom.CacheEffects.Add(effectId, effectData);
     }
 }
コード例 #3
0
        private EffectGo CreateEffectGo(int effectId)
        {
            EffectInfo effectInfo = GetEffectInfo(effectId);

            if (effectInfo == null)
            {
                return(null);
            }
            EffectGo effectGo = new EffectGo
            {
                Time = Time.time,
                Go   = UnityEngine.Object.Instantiate(effectInfo.Prefab)
            };

            effectGo.Go.SetActive(false);
            effectGo.Go.transform.SetParent(goCom.Tran);
            effectGo.Go.transform.position = Vector3.zero;
            return(effectGo);
        }
コード例 #4
0
        private void HandleDashEffect(EffectCom effectCom)
        {
            Entity        entity     = LCECS.ECSLocate.ECS.GetEntity(effectCom.EntityId);
            GameObjectCom goCom      = entity.GetCom <GameObjectCom>();
            Transform     entityTran = goCom.Tran;

            //获得特效节点
            EffectInfo info     = null;
            EffectGo   effectGo = GetEffectGo(effectCom, effectCom.CurrShowEffectId, ref info);

            //动画队列
            Sequence s = DOTween.Sequence();

            for (int i = 0; i < effectGo.Go.transform.childCount; i++)
            {
                Transform dashGo = effectGo.Go.transform.GetChild(i);
                dashGo.gameObject.SetActive(false);
                s.AppendCallback(() => InitDashGo(entityTran, dashGo, i));
                //间隔后,才赋值位置
                s.AppendInterval(info.IntervalTime);
            }
        }