Esempio n. 1
0
 void Start()
 {
     ct          = GameObject.Find("ParticleManager").GetComponentInChildren <ComputeSource>();
     StartPeriod = Mathf.Max(1, StartPeriod);
     _source     = new ShaderConstants.Source(new Vector2(transform.position.x, transform.position.y), StartVelocity, particleColor, spawnPeriod: StartPeriod, group: Group);
     SourceIndex = ct.AddSource(_source);
 }
Esempio n. 2
0
        void Start()
        {
            ParticleManager pm = GameObject.Find("ParticleManager").GetComponent <ParticleManager>();

            cs = pm.GetComponentInChildren <ComputeSource>();
            ps = pm.GetComponentInChildren <ParticleStatistics>();

            //Just use ananyomous event handlers
            ps.ComputeModifierStatistics((s, e) =>
            {
                AliveParticlesText.text = ((ParticleStatisticsModifierEventArgs)e).sum[2].ToString();
            });

            ps.ComputeModifierStatistics(ShaderConstants.PARTICLE_MODIFIER_TARGET, (s, e) =>
            {
                TargetParticlesText.text = ((ParticleStatisticsModifierEventArgs)e).sum[0].ToString();
            });

            StartCoroutine(SlowUpdate());
        }