Пример #1
0
    private void SpreadProjectile()
    {
        // TODO make better Spread projectile physics using better formula.

        float radSpace = 0.04f * Mathf.Sqrt(physicist.ProjectileCount);
        float rad      = radSpace;
        float count    = physicist.ProjectileCount;

        if (physicist.ProjectileCount % 2 != 0)
        {
            CreateProjectile();
            count--;
        }

        for (int i = 0; i < count; i++)
        {
            ProjectileEntity projectile = CreateProjectile();
            projectile.Rotate(rad);
            projectile.Direction = projectile.Direction.Rotated(rad);
            rad += rad > 0 ? radSpace : -radSpace;
            rad *= -1;
        }
    }