예제 #1
0
        public void Emit(Part particle, Vector2 position)
        {
            particle.Reset();
            particle.position = position;

            float angle = Atlas.Rand * (float)Math.PI * 2;

            wantedAngle = wantedAngle % ((float)Math.PI * 2);
            if (wantedAngle < 0)
            {
                wantedAngle = wantedAngle + (float)Math.PI * 2;
            }

            while (Math.Abs(angle - wantedAngle) > (float)Math.PI)
            {
                angle = angle + Math.Sign(wantedAngle - angle) * (float)Math.PI * 2;
            }

            float power = 1 - (Math.Abs(angle - wantedAngle) / ((float)Math.PI)) * wantedAngleWeight;

            particle.vectors[0] = new Vector2((float)Math.Cos(angle), (float)Math.Sin(angle))
                                  * strength.ToDivision(Atlas.Rand * power);

            particle.angle = angle;
            particle.color = color;

            particle.life = _totalLife;
        }
예제 #2
0
        public void Emit(Part particle, Vector2 position)
        {
            particle.Reset();
            particle.position = position;

            float angle = (float)(Math.PI * 2 * Atlas.Rand);

            if (strength.Max != 0 || strength.Min != 0)
            {
                particle.vectors[1] = new Vector2((float)Math.Cos(angle), (float)Math.Sin(angle))
                                      * strength.ToDivision(Atlas.Rand);
            }

            particle.angle = (float)(Math.PI * 2 * Atlas.Rand);
            particle.color = Color.Lerp(Color.White, Color.Gray, Atlas.Rand);

            particle.life = _totalLife;
        }