Exemple #1
0
        public void Fire(GameState g, Vector2d loc, double facing, Vector2d vel)
        {
            Vector2d firePoint = Misc.Vector2dRotate(FirePoint, facing);

            firePoint = Vector2d.Add(firePoint, loc);

            for (int i = 0; i < BulletCount; i++)
            {
                double   deviation      = (Misc.Rand.NextDouble() * Deviation) - (Deviation / 2);
                double   speedDeviation = (Misc.Rand.NextDouble() * Deviation * 5);
                Vector2d fireDir        = Misc.Vector2dRotate(FireDirection, facing + deviation);
                IGameObj s = ShotFunc(firePoint, facing + deviation);
                s.Vel = Vector2d.Multiply(fireDir, ShotVel + speedDeviation);
                s.Vel = Vector2d.Add(s.Vel, vel);
                g.AddObj(s);
            }
        }