Beispiel #1
0
 public Weapon(Player owner, Texture2D skin, Projectile firedprojectile, int damage = 5, int firerate = 0750, int clipsize = 4, int reservesize = 32, int projectilecount = 8, float projectilespeed = 1.5f)
 {
     this.Attributes = new List<Attribute>(16);
     this.Owner = owner;
     this.Skin = skin;
     this.FiredProjectile = firedprojectile;
     this.Damage = damage;
     this.FireRate = firerate;
     this.ClipSize = clipsize;
     this.ReserveSize = reservesize;
     this.ProjectileCount = projectilecount;
     this.FiredProjectileSpeed = projectilespeed;
     this.LastFired = DateTime.Now;
 }
Beispiel #2
0
        /// <summary>
        /// Allows the game to run logic such as updating the world,
        /// checking for collisions, gathering input, and playing audio.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Update(GameTime gameTime)
        {
            GamePadState gState = GamePad.GetState(PlayerIndex.One);
            KeyboardState kState = Keyboard.GetState();
            MouseState mState = Mouse.GetState();

            // Allows the game to exit
            if (gState.Buttons.Back == ButtonState.Pressed || kState.IsKeyDown(Keys.Escape))
                this.Exit();

            if (Players.Count == 0 && mState.MiddleButton == ButtonState.Pressed)
            {
                Player LocalPlayer = new Player(true, new Vector2(0, 0), Soldier, Team.Blu, new PlayerClass(PlayerClass.Class.Medic));
                Players.Add(LocalPlayer);
            }

            foreach (Player P in Players)
            {
                P.Update(gameTime, gState, kState, mState, graphics);
            }

            // TODO: Add your update logic here

            base.Update(gameTime);
        }