Exemple #1
0
        private void OnLoad(object sender, EventArgs e)
        {
            // Object creation
            WinObj        = new Window();
            MapStoreObj   = new MapStore();
            MapObj        = new Map("map0.bmp", ref MapStoreObj);
            ShellStoreObj = new ShellStore();
            PlrObj        = new Player(MapObj.XPlrPos, MapObj.YPlrPos, 0.0f);

            PlrObj.GiveWeapon(10.0f, 1.0f, 2.0f, 5.0f, "Bullet", "MGun", 400, 10.6f);
            PlrObj.SelectWeapon("MGun");

            this.SetStyle(ControlStyles.AllPaintingInWmPaint,  true);
            this.SetStyle(ControlStyles.OptimizedDoubleBuffer, true);

            this.ClientSize = new Size(WinObj.FMH + MapObj.Size + WinObj.FMO, WinObj.FMV + MapObj.Size + WinObj.FMV);

            this.FpsTimer.Interval = WinObj.Fps;

            //this.RoundsProgressBar.SetBounds(2 * WinObj.FMH + MapObj.Size, WinObj.FMV, WinObj.FMO - 2 * WinObj.FMH, 2 * WinObj.FMV);
        }
Exemple #2
0
        /// <summary>
        /// Fire a shell
        /// </summary>
        public void DoFire(ref ShellStore _shellStore)
        {
            System.Timers.Timer test = new System.Timers.Timer();
            if (WeaponsList.ContainsKey(_currWeapon))
                if (WeaponsList[_currWeapon].Rounds > 0)
                    if (_rateFireTimer > 1.0f)
                {

                    // CX - DefaultShell.SIZE / 2.0f compensation of left up corner draw (make shell exit from center of barrel)
                    _shellStore.Add(CX - DefaultShell.SIZE / 2.0f, CY, Ang, _gunAng,
                                    WeaponsList[_currWeapon].SpreadAng, DefaultGunner.BARREL_LENGTH,
                                    WeaponsList[_currWeapon].Velocity);

                    WeaponsList[_currWeapon].Rounds--;
                    _rateFireTimer = 0.0f;
                }
        }