コード例 #1
0
ファイル: Explosion.cs プロジェクト: rhyeen/Cosmonautics
        /// <summary>
        /// Each time CalculateStreams() is called an updated frame of what the explosion should render as is calculated.
        /// </summary>
        /// <returns>Returns true if there is still streams left to Calculate.  False if the explosion is ready to be removed.</returns>
        public bool CalculateStreams()
        {
            particles.CalculateParticles(PARTICLE_REDUCTION);

            for (int i = 0; i < streams.Count; i++)
            {
                streams[i][0] += strength * (float)Math.Cos((streams[i][2] + 90) * Math.PI / 180);
                streams[i][1] += strength * (float)Math.Sin((streams[i][2] + 90) * Math.PI / 180);
                streams[i][3] -= 3f;
                particles.AddParticles(streams[i][0], streams[i][1], 0, 0, streams[i][3], 0, 10, strength / 10);
                particles.AddParticles(streams[i][0], streams[i][1], 0, 0, streams[i][3], 0, 5, strength / 7);
                particles.AddParticles(streams[i][0], streams[i][1], 0, 0, streams[i][3], 0, 5, strength / 5);

                if (streams[i][3] <= 0)
                {
                    streams.RemoveAt(i);
                }
            }
            if (streams.Count == 0 && particles.Count() == 0)
            {
                return(false);
            }
            else
            {
                return(true);
            }
        }