Esempio n. 1
0
    public void OnSpawned(Color _color)
    {
        if (!this.gameObject.activeSelf)
        {
            LoadUtil.SetActive(this.gameObject, true);
        }
        MeshRenderer rd = GetComponentInChildren <MeshRenderer>();

        if (rd != null)
        {
            Material[] mat = rd.materials;
            foreach (Material item in mat)
            {
                if (item.HasProperty("_TintColor"))
                {
                    item.SetColor("_TintColor", _color);
                }
                else
                {
                    item.color = _color;
                }
            }
        }
        FXCtrl.RePlay(this.gameObject);
        base.OnSpawned();
        if (!GameHelper.haveDontDestroyRingEffect)
        {
            //Debug.Log("GameHelper.haveDontDestroyRingEffect = :"+ GameHelper.haveDontDestroyRingEffect);
            DontDestroyOnLoad(this);
            GameHelper.haveDontDestroyRingEffect = true;            //只需要执行一次就可以了
        }
    }
Esempio n. 2
0
    public override void OnSpawned()
    {
        if (!this.gameObject.activeSelf)
        {
            LoadUtil.SetActive(this.gameObject, true);
        }
        FXCtrl.RePlay(this.gameObject);
        base.OnSpawned();
        DontDestroyOnLoad(this);

        Invoke("ReturnBySelf", duration);
    }
Esempio n. 3
0
 public void OnSpawned(float _duration, bool _matchingSpeed)
 {
     if (!this.gameObject.activeSelf)
     {
         LoadUtil.SetActive(this.gameObject, true);
     }
     if (_matchingSpeed)
     {
         FXCtrl.RePlayMatchingSpeed(this.gameObject, _duration);
     }
     else
     {
         FXCtrl.RePlay(this.gameObject);
     }
     base.OnSpawned();
     if (_duration > 0)
     {
         Invoke("ReturnBySelf", _duration);
     }
 }
Esempio n. 4
0
    public void OnSpawned(AbilityBallisticCurveInfo _info)
    {
        info         = _info;
        needDespawed = false;
        starttime    = 0;
        if (info == null)
        {
            OnDespawned();
            return;
        }
        curStartPos = info.StartPos;
        speed       = info.Speed;
        addSpeed    = info.AddSpeed;
        lockLastDis = 0;
        if (info.IsLock && info.Target != null)
        {
            targetTransform = info.Target.HitPoint;
        }
        if (effect != null)
        {
            GameCenter.spawner.DespawnEffecter(effect);
        }
        GameCenter.spawner.SpawnEffecter(info.EffectName, -1, (x) =>
        {
            //清理原特效,主要因为两次异步可能导致多个特效加载很慢的特效同时存在 by吴江
            if (effect != null)
            {
                GameCenter.spawner.DespawnEffecter(effect);
            }
            int count = this.transform.childCount;
            if (count > 0)
            {
                PoolEffecter[] p = new PoolEffecter[count];
                for (int i = 0; i < count; i++)
                {
                    effect = this.transform.GetChild(i).gameObject.GetComponent <PoolEffecter>();
                    p[i]   = effect;
                }
                foreach (var item in p)
                {
                    GameCenter.spawner.DespawnEffecter(item);
                }
            }
            count = this.transform.childCount;
            if (count > 0)
            {
                for (int i = 0; i < count; i++)
                {
                    Destroy(this.transform.GetChild(i).gameObject);
                }
            }
            effect = x;
            effect.transform.parent           = this.transform;
            effect.transform.localPosition    = Vector3.zero;
            effect.transform.localEulerAngles = Vector3.zero;
            this.transform.localEulerAngles   = info.Direction;

            Vector3 now      = info.StartPos + info.Direction * 10;
            Vector3 velocity = now - transform.position;
            curStartPos      = info.StartPos;
            if (velocity != Vector3.zero)
            {
                transform.forward = velocity;
            }
            starttime = Time.time;
            if (!this.gameObject.activeSelf)
            {
                LoadUtil.SetActive(this.gameObject, true);
            }
        }, false);
        base.OnSpawned();
        transform.position = _info.StartPos;
        GameCenter.soundMng.PlaySound(info.PlaySound, SoundMng.GetSceneSoundValue(transform, GameCenter.curMainPlayer.transform), false, true);
    }