Example #1
0
        public override void Unsubscribe()
        {
            GUIForm.Paint -= OnPaint;
            foreach (var tank1 in Tanks)
            {
                tank1.Unsubscribe();
                tank1.CheckPosition -= Field.GetCheckPositionListener();
                tank1.Shot          -= OnShot;
                tank1.Destroyed     -= OnTankDestroyed;
                var compTank = tank1 as CompTank;
                if (compTank.IsBonus)
                {
                    compTank.BonusShoot -= OnBonusShoot;
                }

                foreach (var tank2 in Tanks)
                {
                    if (tank1 != tank2)
                    {
                        tank1.CheckPosition -= tank2.GetCheckPositionListener();
                        tank2.CheckPosition -= tank1.GetCheckPositionListener();
                    }
                }
                /**/
                foreach (var playerTank in Field.PlayersManager.Tanks)
                {
                    playerTank.CheckPosition -= compTank.GetCheckPositionListener();
                    compTank.CheckPosition   -= playerTank.GetCheckPositionListener();
                }
            }
            TanksOnField.Clear();
            _respawnTimer.Stop();
        }
Example #2
0
 public void SetNewGameTanksParameters(int players)
 {
     TanksOnField.Clear();
     foreach (var tank in Tanks)
     {
         tank.SetNewGameParameters();
     }
 }
Example #3
0
        public void SetNewStageTanksParameters()
        {
            TanksOnField.Clear();
            AliveTanks             = MAX_STAGE_TANKS;
            _respawnTimer.Interval = TankRespawnTime();
            _respawnTimer.Start();
            _currentRespawnTank = 0;

            ((CompTank)Tanks[3]).IsBonus  = true;
            ((CompTank)Tanks[10]).IsBonus = true;
            ((CompTank)Tanks[18]).IsBonus = true;

            //DEBUG
            //foreach(var tank in Tanks)
            //    ((CompTank)tank).IsBonus = true;
        }