public Super CreateSuper()
        {
            Super temp = ((Super)(Find(GameObjName.Super)));

            if (temp != null)
            {
                ((Super)(Find(GameObjName.Super))).Purge();
            }

            ColObj _colobj = new ColObj(Rectangle.Empty, ColObjName.Super, SpriteName.BBox);

            ColObjManager.getInstance().Add(_colobj);
            Super Obj;

            if (temp != null)
            {
                Obj          = temp;
                Obj.BombPool = temp.BombPool;
            }
            else
            {
                Obj          = new Super(GameObjName.Super, _colobj, new Vector2(0, 0));
                Obj.BombPool = new BombReserve();

                ColGroup Invaders = ColGroupManager.getInstance().find(ColGroupName.Alien);
                Invaders.Add(Obj);

                GameObjMananger.getInstance().Add(Obj);
            }

            Obj.Create();


            return(Obj);
        }
        public void Initialize(GraphicsDeviceManager graphics, SpriteBatch spritebatch)
        {
            TextureManager.getInstance().Initialize();
            TextureManager.getInstance().CreateGameTextures();

            SoundManager.getInstance().Initialize();
            SoundManager.getInstance().CreateSounds();

            ImageManager.getInstance().Initialize();
            ImageManager.getInstance().CreateGameImages();

            SpriteManager.getInstance().Initialize();
            SpriteManager.getInstance().CreateAllSprites();

            AnimationManager.getInstance().Initialize();
            AnimationManager.getInstance().CreateAnimations();

            SpriteBatchManager.getInstance().Initialize();
            SpriteBatchManager.getInstance().CreateAllSpriteBatches(graphics.GraphicsDevice);
            SpriteBatchManager.getInstance().CreateMenu(graphics.GraphicsDevice);

            ColObjManager.getInstance().Initialize();
            GameObjMananger.getInstance().Initialize();

            ColGroupManager.getInstance().Initialize();
            ColGroupManager.getInstance().Create();

            ColPairManager.getInstance().Initialize();
            ColPairManager.getInstance().CreateCollisionPairs();

            GameObjMananger.getInstance().CreateSuper();
            GameObjMananger.getInstance().CreateLevel(graphics.GraphicsDevice);
            GameObjMananger.getInstance().CreateShield();
            GameObjMananger.getInstance().CreateShip();
            GameObjMananger.getInstance().CreateUI();
            GameObjMananger.getInstance().CreateUfo();

            InputManager.Instance().Initialize();
            TimeEventManager.getInstance().Initialize();
            TimeEventManager.getInstance().StartTimedEvents();

            ScreenManager.Instance().CurrentScreen = Screen.MainMenu;
            ScreenManager.Instance().switchScreen();

            getCurrentPlayerData();

            CurrLevel  = 0;
            Difficulty = CurrLevel * 2;
        }
        public Ship CreateShip()
        {
            Rectangle inRect = new Rectangle(476, 715, 58, 32);

            TextureSprite Text    = new TextureSprite(inRect, new Vector2(1, 1), 0.0f, 1.0f, SpriteName.Ship);
            ColObj        _colobj = new ColObj(inRect, ColObjName.Ship, SpriteName.BBox);
            Ship          Obj     = new Ship(GameObjName.Ship, _colobj, new Vector2(inRect.X, inRect.Y), Text, ColGroupName.Ship);

            ColObjManager.getInstance().Add(_colobj);
            SpriteBatchManager.getInstance().Find(SpriteBatchName.Scene).Add(Text);
            ColGroupManager.getInstance().find(ColGroupName.Ship).Add(Obj);

            GameObjMananger.getInstance().Add(Obj);

            this.CreateMissile(new Rectangle(inRect.X + inRect.Width / 2 - 10 / 2, inRect.Y - 2, 10, 16));

            return(Obj);
        }
Beispiel #4
0
        public void CreateCollisionPairs()
        {
            ///Alien WAll
            ColPair Obj = new ColPair(ColGroupManager.getInstance().find(ColGroupName.Alien), ColGroupManager.getInstance().find(ColGroupName.Wall));

            this.Add(Obj);

            ///Alien Missile
            Obj = new ColPair(ColGroupManager.getInstance().find(ColGroupName.Alien), ColGroupManager.getInstance().find(ColGroupName.Missile));
            this.Add(Obj);

            //Missile Wall
            Obj = new ColPair(ColGroupManager.getInstance().find(ColGroupName.Missile), ColGroupManager.getInstance().find(ColGroupName.Wall));
            this.Add(Obj);

            //Missile Shield
            Obj = new ColPair(ColGroupManager.getInstance().find(ColGroupName.Shield), ColGroupManager.getInstance().find(ColGroupName.Missile));
            this.Add(Obj);

            //Bomb Wall
            Obj = new ColPair(ColGroupManager.getInstance().find(ColGroupName.Bomb), ColGroupManager.getInstance().find(ColGroupName.Wall));
            this.Add(Obj);

            //Bomb Shield
            Obj = new ColPair(ColGroupManager.getInstance().find(ColGroupName.Shield), ColGroupManager.getInstance().find(ColGroupName.Bomb));
            this.Add(Obj);

            //Bomb Missile
            Obj = new ColPair(ColGroupManager.getInstance().find(ColGroupName.Bomb), ColGroupManager.getInstance().find(ColGroupName.Missile));
            this.Add(Obj);

            //Bomb Ship
            Obj = new ColPair(ColGroupManager.getInstance().find(ColGroupName.Bomb), ColGroupManager.getInstance().find(ColGroupName.Ship));
            this.Add(Obj);

            //Missile UFO
            Obj = new ColPair(ColGroupManager.getInstance().find(ColGroupName.Ufo), ColGroupManager.getInstance().find(ColGroupName.Missile));
            this.Add(Obj);

            //Alien Shield
            Obj = new ColPair(ColGroupManager.getInstance().find(ColGroupName.Alien), ColGroupManager.getInstance().find(ColGroupName.Shield));
            this.Add(Obj);
        }
        public UFO CreateUfo()
        {
            Rectangle inRect = new Rectangle(-70, 120, 95 / 2, 46 / 2);

            TextureSprite Text    = new TextureSprite(inRect, new Vector2(1, 1), 0.0f, 1.0f, SpriteName.Ufo);
            ColObj        _colobj = new ColObj(inRect, ColObjName.UFO, SpriteName.BBox);

            ColObjManager.getInstance().Add(_colobj);
            UFO Obj = new UFO(GameObjName.UFO, _colobj, new Vector2(inRect.X, inRect.Y), Text, 100);

            SpriteBatchManager.getInstance().Find(SpriteBatchName.Scene).Add(Text);

            ColGroup Invaders = ColGroupManager.getInstance().find(ColGroupName.Ufo);

            Invaders.Add(Obj);

            GameObjMananger.getInstance().Add(Obj);

            return(Obj);
        }
        public void KillObject(GameObj inObj, SpriteBatchName inSpName)
        {
            GameSprite _gameSprite = inObj.getGameSprite();

            if (_gameSprite != null)
            {
                SpriteBatchManager.getInstance().Kill(_gameSprite, inSpName);
            }

            ColObj _colObj = inObj.getColObj();

            if (_colObj != null)
            {
                ColObjManager.getInstance().Kill(_colObj);
            }

            ColGroup _ColGroup = ColGroupManager.getInstance().find(inObj.TempColGroupName);

            _ColGroup.Kill(inObj);

            Kill(inObj);
        }
        public Bomb CreateBomb(Rectangle inRect)
        {
            TextureSprite Text    = new TextureSprite(inRect, new Vector2(1, 1), 0.0f, 1.0f, SpriteName.Bomb);
            ColObj        _colobj = new ColObj(inRect, ColObjName.Missile, SpriteName.BBox);
            Bomb          Obj     = new Bomb(GameObjName.Missile, _colobj, new Vector2(inRect.X, inRect.Y), Text, ColGroupName.Bomb);

            ColGroup X = ColGroupManager.getInstance().find(Obj.TempColGroupName);

            if (X == null)
            {
                ColGroupManager.getInstance().find(ColGroupName.Bomb);
            }

            ColObjManager.getInstance().Add(_colobj);
            SpriteBatchManager.getInstance().Find(SpriteBatchName.Scene).Add(Text);

            ColGroupManager.getInstance().find(Obj.TempColGroupName).Add(Obj);

            GameObjMananger.getInstance().Add(Obj);

            return(Obj);
        }
        public Missile CreateMissile(Rectangle inRect)
        {
            TextureSprite Text    = new TextureSprite(inRect, new Vector2(1, 1), 0.0f, 1.0f, SpriteName.Missile);
            ColObj        _colobj = new ColObj(inRect, ColObjName.Missile, SpriteName.BBox);
            Missile       Obj     = new Missile(GameObjName.Missile, _colobj, new Vector2(inRect.X, inRect.Y), Text, ColGroupName.Missile);

            ColGroup X = ColGroupManager.getInstance().find(Obj.TempColGroupName);

            if (X == null)
            {
                ColGroupManager.getInstance().find(ColGroupName.Missile);
            }

            ColObjManager.getInstance().Add(_colobj);
            SpriteBatchManager.getInstance().Find(SpriteBatchName.Scene).Add(Text);

            ColGroupManager.getInstance().find(Obj.TempColGroupName).Add(Obj);

            GameObjMananger.getInstance().Add(Obj);
            Obj.setStatus(false);
            ((Ship)(GameObjMananger.getInstance().Find(GameObjName.Ship))).setMissile(Obj);

            return(Obj);
        }
        public Wall CreateLevel(GraphicsDevice Graph)
        {
            //////////////////////////////////////////Walls
            ColGroup Walls = ColGroupManager.getInstance().find(ColGroupName.Wall);

            //Left Wall
            ColObj _colobj = new ColObj(new Rectangle(15, 100, 5, Graph.Viewport.Height - 145), ColObjName.Wall, SpriteName.BBox);
            Wall   Obj     = new Wall(GameObjName.Wall, _colobj, new Vector2(15, 100));

            ColObjManager.getInstance().Add(_colobj);
            ColGroupManager.getInstance().find(ColGroupName.Wall).Add(Obj);
            GameObjMananger.getInstance().Add(Obj);

            //Right Wall
            _colobj = new ColObj(new Rectangle(Graph.Viewport.Width - 15, 100, 5, Graph.Viewport.Height - 145), ColObjName.Wall, SpriteName.BBox);
            Obj     = new Wall(GameObjName.Wall, _colobj, new Vector2(Graph.Viewport.Width - 15, 100));
            ColObjManager.getInstance().Add(_colobj);
            ColGroupManager.getInstance().find(ColGroupName.Wall).Add(Obj);
            GameObjMananger.getInstance().Add(Obj);

            //Top Wall
            _colobj = new ColObj(new Rectangle(15, 100, Graph.Viewport.Width - 25, 5), ColObjName.Wall, SpriteName.BBox);
            Obj     = new Wall(GameObjName.Wall, _colobj, new Vector2(15, 100));
            ColObjManager.getInstance().Add(_colobj);
            ColGroupManager.getInstance().find(ColGroupName.Wall).Add(Obj);
            GameObjMananger.getInstance().Add(Obj);

            //Bottom Wall
            _colobj = new ColObj(new Rectangle(15, Graph.Viewport.Height - 50, Graph.Viewport.Width - 25, 5), ColObjName.Wall, SpriteName.BBox);
            Obj     = new Wall(GameObjName.Wall, _colobj, new Vector2(15, Graph.Viewport.Height - 50));
            ColObjManager.getInstance().Add(_colobj);
            ColGroupManager.getInstance().find(ColGroupName.Wall).Add(Obj);
            GameObjMananger.getInstance().Add(Obj);

            return(Obj);
        }
        public Shield CreateShield()
        {
            ColGroup  Shields = ColGroupManager.getInstance().find(ColGroupName.Shield);
            Rectangle inRect  = new Rectangle(150, 600, 100, 100);
            Rectangle inRectparts;

            //Shield 1
            TextureSprite Text    = new TextureSprite(inRect, new Vector2(1, 1), 0.0f, 1.0f, SpriteName.Shield);
            ColObj        _colobj = new ColObj(inRect, ColObjName.Shield, SpriteName.BBox);
            Shield        Obj     = new Shield(GameObjName.Shield, _colobj, new Vector2(inRect.X, inRect.Y), Text, ColGroupName.Shield);

            ColObjManager.getInstance().Add(_colobj);
            // SpriteBatchManager.getInstance().Find(SpriteBatchName.Scene).Add(Text);
            ColGroupManager.getInstance().find(ColGroupName.Shield).Add(Obj);

            inRectparts = new Rectangle(inRect.X, inRect.Y, 10, 10);
            Obj.Create(inRectparts);

            GameObjMananger.getInstance().Add(Obj);


            inRect = new Rectangle(350, 600, 100, 100);
            //Shield 2
            Text    = new TextureSprite(inRect, new Vector2(1, 1), 0.0f, 1.0f, SpriteName.Shield);
            _colobj = new ColObj(inRect, ColObjName.Shield, SpriteName.BBox);
            Obj     = new Shield(GameObjName.Shield, _colobj, new Vector2(inRect.X, inRect.Y), Text, ColGroupName.Shield);
            ColObjManager.getInstance().Add(_colobj);
            // SpriteBatchManager.getInstance().Find(SpriteBatchName.Scene).Add(Text);
            ColGroupManager.getInstance().find(ColGroupName.Shield).Add(Obj);

            inRectparts = new Rectangle(inRect.X, inRect.Y, 10, 10);
            Obj.Create(inRectparts);

            GameObjMananger.getInstance().Add(Obj);

            inRect = new Rectangle(550, 600, 100, 100);
            //Shield 3
            Text    = new TextureSprite(inRect, new Vector2(1, 1), 0.0f, 1.0f, SpriteName.Shield);
            _colobj = new ColObj(inRect, ColObjName.Shield, SpriteName.BBox);
            Obj     = new Shield(GameObjName.Shield, _colobj, new Vector2(inRect.X, inRect.Y), Text, ColGroupName.Shield);
            ColObjManager.getInstance().Add(_colobj);
            ColGroupManager.getInstance().find(ColGroupName.Shield).Add(Obj);

            inRectparts = new Rectangle(inRect.X, inRect.Y, 10, 10);
            Obj.Create(inRectparts);

            GameObjMananger.getInstance().Add(Obj);

            inRect = new Rectangle(750, 600, 100, 100);
            //Shield 4
            Text    = new TextureSprite(inRect, new Vector2(1, 1), 0.0f, 1.0f, SpriteName.Shield);
            _colobj = new ColObj(inRect, ColObjName.Shield, SpriteName.BBox);
            Obj     = new Shield(GameObjName.Shield, _colobj, new Vector2(inRect.X, inRect.Y), Text, ColGroupName.Shield);
            ColObjManager.getInstance().Add(_colobj);
            ColGroupManager.getInstance().find(ColGroupName.Shield).Add(Obj);

            inRectparts = new Rectangle(inRect.X, inRect.Y, 10, 10);
            Obj.Create(inRectparts);

            GameObjMananger.getInstance().Add(Obj);

            return(Obj);
        }