Exemplo n.º 1
0
 public override void SetFxList()
 {
     base.SetFxList();
     FxList.Add(new FxItem(BeatRepeat.DisplayName, BeatRepeat, typeof(FxBeatRepeatView)));
     FxList.Add(new FxItem(BeatShift.DisplayName, BeatShift, typeof(FxBeatShiftView)));
     FxList.Add(new FxItem(BeatScatter.DisplayName, BeatScatter, typeof(FxBeatScatterView)));
     FxList.Add(new FxItem(VinylFlick.DisplayName, VinylFlick, typeof(FxVinylFlickView)));
 }
Exemplo n.º 2
0
 private void Awake()
 {
     MaxFxCount = Mathf.Clamp(MaxFxCount, 3, 5);
     for (int i = 0; i < MaxFxCount; i++)
     {
         ParticleSystemUIComponent newObj = GameObject.Instantiate(Fx, this.transform);
         newObj.gameObject.CustomSetActive(true);
         DisableFx(newObj);
         FxList.Add(newObj);
     }
 }
Exemplo n.º 3
0
        /// <summary>
        /// 创建一个特效对象.
        /// </summary>
        /// <returns>特效对象.</returns>
        /// <param name="fxName">特效的名字.</param>
        public Fx CreateFx(string fxName)
        {
            if (fxName == "")
            {
                return(null);
            }

            //先从池中找未使用的特效-
            Fx fx = null;

            for (int i = 0; i < FxList.Count; i++)
            {
                fx = FxList[i];
                if (fx.Instance && fx.Instance.name == fxName && !fx.IsUsed && !fx.IsClosing)
                {
                    fx.IsUsed = true;

                    if (fx.RootParticle)
                    {
                        fx.RootParticle.time = 0.0f;
                    }

                    fx.Play(false);
                    fx.RootParticle.Clear();

                    return(fx);
                }
            }

            Fx newFx = new Fx();

            newFx.Instance = new GameObject("Fx_" + fxName);
            ParticleSystem ps = newFx.Instance.AddComponent <ParticleSystem>();

            ps.GetComponent <Renderer>().enabled = false;
            //newFx.Instance = ysResManager.Instance().GetEffectPrefab(fxName);
            newFx.Instance.SetActive(true);
            //ysFixShaderTool.ResetShader(newFx.Instance);
            newFx.Instance.name = fxName;
            newFx.RootParticle  = newFx.Instance.GetComponent <ParticleSystem>();
            newFx.IsUsed        = true;

            FxList.Add(newFx);

            newFx.Instance.transform.parent        = this.transform;
            newFx.Instance.transform.localPosition = Vector3.zero;
            newFx.Instance.transform.localRotation = Quaternion.identity;
            newFx.Instance.transform.localScale    = Vector3.one;
            newFx.ParentTransform = this.transform;
            newFx.Play(false);

            return(newFx);
        }