Esempio n. 1
0
        ClsPlaneTextureIndexStripVB ground;                             //Terreno

        public ProjectileManager(Model model, ClsPlaneTextureIndexStripVB ground)
        {
            this.projectileModel = model;
            this.projectiles     = new List <Projectile>();
            this.deadProjectiles = new List <Projectile>();
            this.ground          = ground;
        }
Esempio n. 2
0
 public Projectile(Model model, Vector3 pos, Vector3 dirH, float dirAngle, ClsPlaneTextureIndexStripVB ground, int ParentID)
 {
     this.scaleMatrix          = Matrix.CreateScale(0.02f);
     this.model                = model;
     this.worldMatrix          = Matrix.Identity;
     this.model.Root.Transform = scaleMatrix * worldMatrix;
     this.boneTransforms       = new Matrix[model.Bones.Count];
     this.model.CopyAbsoluteBoneTransformsTo(boneTransforms);
     this.dirH              = dirH;
     this.ground            = ground;
     this.pos               = pos;
     this.ParentId          = ParentID;
     this.hSpeed            = 0.8f;
     this.secondsSinceBirth = 0;
     this.totalHeight       = 0;
     this.prevHeight        = 0;
     this.dead              = false;
     this.dirAngle          = dirAngle;
     this.radius            = 0.2f;
     this.gravity           = 9.8f;
     this.force             = 0.2f;
 }
Esempio n. 3
0
        public Camera(GraphicsDevice graphicsDevice, ClsPlaneTextureIndexStripVB terreno)
        {
            teste = false;
            float aspectRatio = (float)graphicsDevice.Viewport.Width / (float)graphicsDevice.Viewport.Height;

            projection             = Matrix.CreatePerspectiveFieldOfView(MathHelper.ToRadians(90.0f), aspectRatio, 0.2f, 1000.0f);
            pos                    = new Vector3(15, 10, 10);
            target                 = Vector3.UnitZ;
            yaw                    = 10;
            pitch                  = 0;
            viewMatrix             = Matrix.CreateLookAt(pos, target, Vector3.Up);
            this.graphicsDevice    = graphicsDevice;
            escalaRadianosPorPixel = (float)Math.PI / 1000f;
            Mouse.SetPosition(this.graphicsDevice.Viewport.Width / 2, this.graphicsDevice.Viewport.Height / 2);
            this.terreno = terreno;
            effect       = new BasicEffect(graphicsDevice);
            effect.EnableDefaultLighting();
            effect.DirectionalLight0.Enabled      = true;
            effect.DirectionalLight0.Direction    = Vector3.Normalize(new Vector3(1, -0.5f, 0));
            effect.DirectionalLight0.DiffuseColor = new Vector3(0.5f, 0.5f, 0.5f);
            effect.AmbientLightColor  = new Vector3(0.5f, 0.5f, 0.5f);
            effect.VertexColorEnabled = false;
        }
Esempio n. 4
0
 protected override void LoadContent()
 {
     #region P1Keys
     player1Keys = new List <Keys>();
     player1Keys.Add(Keys.A);
     player1Keys.Add(Keys.D);
     player1Keys.Add(Keys.W);
     player1Keys.Add(Keys.S);
     player1Keys.Add(Keys.Space);
     player1Keys.Add(Keys.Left);
     player1Keys.Add(Keys.Right);
     player1Keys.Add(Keys.Up);
     player1Keys.Add(Keys.Down);
     player1Keys.Add(Keys.F6);
     #endregion
     #region P2Keys
     player2Keys = new List <Keys>();
     player2Keys.Add(Keys.J);
     player2Keys.Add(Keys.L);
     player2Keys.Add(Keys.I);
     player2Keys.Add(Keys.K);
     player2Keys.Add(Keys.Enter);
     player2Keys.Add(Keys.OemPlus);
     player2Keys.Add(Keys.NumPad3);
     player2Keys.Add(Keys.NumPad2);
     player2Keys.Add(Keys.NumPad0);
     player2Keys.Add(Keys.F7);
     #endregion
     Cls3DAxis   = new Cls3DAxis(GraphicsDevice);
     spriteBatch = new SpriteBatch(GraphicsDevice);
     terrain     = new ClsPlaneTextureIndexStripVB(GraphicsDevice, 0.2f, Content.Load <Texture2D>("terreno"), Content.Load <Texture2D>("textura"));
     projManager = new ProjectileManager(Content.Load <Model>("rain"), terrain);
     camera      = new Camera(GraphicsDevice, terrain);
     tank        = new Tank(Content.Load <Model>("tank"), terrain, new Vector3(15, 15, 15), GraphicsDevice, Tank.PlayerMode.PC, 0, player1Keys, 100);
     tankAI      = new Tank(Content.Load <Model>("tank"), terrain, new Vector3(90, 90, 90), GraphicsDevice, Tank.PlayerMode.AI, 1, player2Keys, 100);
     colManager  = new CollisionManager(tank, tankAI);
 }