示例#1
0
        private void handleSpaceShipHit(SpaceShip i_SpaceShip)
        {
            ScoreManager scoreManager = SpaceInvaders.s_GameUtils.ScoreManager;

            if (scoreManager.Souls.Count - 1 == 0)
            {
                i_SpaceShip.RemoveComponent();
                SpaceInvaders.s_GameUtils.InputOutputManager.ShowGameOverMessage();
                this.m_Game.Exit();
            }
            else
            {
                i_SpaceShip.InitPosition();
                scoreManager.UpdateScoreAfterHit(i_SpaceShip);
            }
        }
示例#2
0
 public SpaceInvaders()
 {
     s_RandomNum = new Random();
     s_GameUtils = new GameUtils();
     s_GameUtils.ShootingManager = new ShootingManager(this);
     s_GameUtils.ScoreManager    = new ScoreManager(this);
     Components.Add(s_GameUtils.ScoreManager);
     s_GameUtils.InputOutputManager = new InputOutputManager();
     this.m_Background = new Background(this);
     Components.Add(this.m_Background);
     this.m_Graphics       = new GraphicsDeviceManager(this);
     Content.RootDirectory = "Content";
     this.m_SpaceShip      = new SpaceShip(this);
     Components.Add(this.m_SpaceShip);
     this.m_MotherSpaceShip = new MotherSpaceShip(this);
     Components.Add(this.m_MotherSpaceShip);
     this.m_EnemysGroup = new EnemiesGroup(this);
     Components.Add(this.m_EnemysGroup);
     this.IsMouseVisible = true;
 }