Пример #1
0
        public void SpawnParticleEffectWithColor(string eff_name, Vector3 world_pos, Color color, float delay_kill = 2)
        {
            PSEffectProfile profile = partical_effects.Find(x => x.eff_name == eff_name);

            if (profile != null)
            {
                ParticleSystem ps = ResourceManager.Instance.CreateInstance <ParticleSystem>(profile.path, null);
                ps.transform.position   = world_pos;
                ps.transform.localScale = Vector3.one;

                ParticleSystem[] pss = ps.gameObject.GetComponentsInChildren <ParticleSystem>();
                foreach (var pppps in pss)
                {
                    //HackMe:看看有没有其他方式,设置粒子的颜色
                    //Debug.Log("ps name " + pppps.name +"Color is " + color);
                    pppps.startColor = color;
                }

                ps.Play(true);

                if (delay_kill > 0)
                {
                    Destroy(ps.gameObject, 2);
                }
            }
        }
Пример #2
0
        public ParticleSystem SpawnParticleEffectForUGUI(string eff_name, Graphic parent, float delay_kill = 2)
        {
            PSEffectProfile profile = partical_effects.Find(x => x.eff_name == eff_name);

            if (profile != null)
            {
                ParticleSystem ps = ResourceManager.Instance.CreateInstance <ParticleSystem>(profile.path, null);
                ps.gameObject.layer        = LayerMask.NameToLayer("UI");
                ps.transform.parent        = parent.transform;
                ps.transform.localPosition = Vector3.zero;
                ps.transform.localScale    = Vector3.one;

                ps.Play(true);

                if (delay_kill > 0)
                {
                    Destroy(ps.gameObject, delay_kill);
                }

                return(ps);
            }
            return(null);
        }
Пример #3
0
        public ParticleSystem SpawnParticleEffect(string eff_name, Vector3 world_pos, float delay_kill = 2)
        {
            PSEffectProfile profile = partical_effects.Find(x => x.eff_name == eff_name);

            if (profile != null)
            {
                ParticleSystem ps = ResourceManager.Instance.CreateInstance <ParticleSystem>(profile.path, null);
                //ps.transform.parent = GameManager.Instance.gameObject.transform;
                ps.transform.position   = world_pos;
                ps.transform.localScale = Vector3.one;

                ps.Play(true);

                if (delay_kill > 0)
                {
                    Destroy(ps.gameObject, delay_kill);
                }

                return(ps);
            }

            Debug.Log("Profile not found!");
            return(null);
        }