Exemplo n.º 1
0
    void Awake()
    {
        //初始化 对象引用
        int count = this.transform.childCount;

        childs = new Transform[count];
        //for (int i = count - 1; i >= 0; i--)
        //{
        //    childs[i] = this.transform.GetChild(i);
        //    if (childs[i].gameObject.activeInHierarchy == false)
        //    {
        //        childs[i].gameObject.SetActive(true);
        //    }
        //}

        lightningEmitter = this.gameObject.GetComponent <LightningEmitter>();

        if (particlesystems == null || particlesystems.Length == 0)
        {
            particlesystems = GetComponentsInChildren <ParticleSystem>(true);
        }
        if (particheAnimators == null || particheAnimators.Length == 0)
        {
            particheAnimators = GetComponentsInChildren <Animator>(true);
        }

        trailRenderer = this.gameObject.GetComponentsInChildrenFast <TrailRenderer>(true);

        mySerlizedID = CreateSerlizedID();
    }
Exemplo n.º 2
0
    public void CastLightingShake(AbilityInstance _instance)
    {
        if (_instance == null || _instance.CurClientShowType != ClientShowType.Lightingskill)
        {
            return;
        }
        List <Transform> list       = _instance.TargetTransforms;
        string           effectName = _instance.ProcessEffectList.Count > 0 ? _instance.ProcessEffectList[0] : "e_c_lightning_emitter";

        for (int i = 0; i < list.Count; i++)
        {
            System.Action preLoad = Utils.Functor <int>(i, (z) =>
            {
                GameCenter.spawner.SpawnEffecter(effectName, 1.0f, (x) =>
                {
                    LightningEmitter le = x.GetComponent <LightningEmitter>();
                    if (le != null)
                    {
                        if (z <= 0)
                        {
                            le.Target1 = _instance.UserActor.HitPoint;
                        }
                        else
                        {
                            le.Target1 = list[z - 1];
                        }
                        le.Target2   = list[z];
                        le.animSpeed = 3.0f;
                    }
                    else
                    {
                        Debug.LogError("闪电链特效组件缺失,播放失败");
                    }
                }, false);
            });
            preLoad();
        }
    }
Exemplo n.º 3
0
 /// <summary>
 /// 创建链式特效(唯一) by吴江
 /// </summary>
 /// <param name="_tarA"></param>
 /// <param name="_tarB"></param>
 /// <param name="_effectName"></param>
 public void CastLineEffect(Actor _tarA, Actor _tarB, string _effectName, float _speed = 1.0f)
 {
     if (lineEffectDic.ContainsKey(_effectName))
     {
         Destroy(lineEffectDic[_effectName] as GameObject);
         lineEffectDic.Remove(_effectName);
     }
     if (_tarA == null || _tarB == null)
     {
         return;
     }
     AssetMng.GetEffectInstance(_effectName, (x) =>
     {
         lineEffectDic[_effectName] = x;
         LightningEmitter le        = x.GetComponent <LightningEmitter>();
         if (le != null)
         {
             le.Target1   = _tarA.HitPoint;
             le.Target2   = _tarB.HitPoint;
             le.animSpeed = _speed;
         }
     });
 }
Exemplo n.º 4
0
 private void Start()
 {
     emitter = GameObject.FindGameObjectWithTag("Emitter");
     le      = emitter.GetComponent <LightningEmitter>();
 }