示例#1
0
 public Rocket(Vector2 position, Vector2 speed, float rotation)
 {
     Position = position;
     Size     = 16;
     Speed    = speed + new Vector2(7f * Maf.Sin(rotation), -7f * Maf.Cos(rotation));
     Rotation = rotation;
 }
示例#2
0
        public override void Shoot(World world)
        {
            Rocket rocket1 = new Rocket(Owner.Position + new Vector2(-40f * Maf.Cos(Owner.Rotation), -40f * Maf.Sin(Owner.Rotation)), Owner.Speed, Owner.Rotation);
            Rocket rocket2 = new Rocket(Owner.Position + new Vector2(40f * Maf.Cos(Owner.Rotation), 40f * Maf.Sin(Owner.Rotation)), Owner.Speed, Owner.Rotation);

            world.Add(rocket1);
            world.Add(rocket2);
        }
示例#3
0
 // C O N S T R U C T
 public Camera(GraphicsDevice gpu, Vector3 UpDirection, Input input)
 {
     up             = UpDirection;
     inp            = input;
     pos            = new Vector3(20, 12, -90);
     target         = Vector3.Zero;
     maf            = new Maf();
     view           = Matrix.CreateLookAt(pos, target, up);
     proj           = Matrix.CreatePerspectiveFieldOfView(MathHelper.PiOver4, gpu.Viewport.AspectRatio, 1.0f, FAR_PLANE);
     view_proj      = view * proj;
     unit_direction = view.Forward;   unit_direction.Normalize();
 }
示例#4
0
        public override void Shoot(World world)
        {
            var kickRocket  = 20f;
            var speedRocket = 14.9f;

            PlasmaBullet plasmaBullet = new PlasmaBullet()
            {
                Size     = 10,
                Position = Owner.Position + kickRocket * new Vector2(Maf.Sin(Owner.Rotation), -Maf.Cos(Owner.Rotation)),
                Speed    = Owner.Speed + speedRocket * new Vector2(Maf.Sin(Owner.Rotation), -Maf.Cos(Owner.Rotation))
            };

            world.Add(plasmaBullet);
        }