Пример #1
0
        public void process()
        {
            int count = inpQ.Count;

            CollisionManager.GameObjManager pObj = CollisionManager.GameObjManager.Instance();

            for (int i = 0; i < count; i++)
            {
                qHeader pInstance = inpQ.Dequeue();

                switch (pInstance.type)
                {
                case QueueType.ship_impulse:
                    ship_impulse imp = (ship_impulse)pInstance.obj;
                    imp.execute();
                    break;

                case QueueType.ship_missile:
                    Ship_Create_Missile_Message smiss = (Ship_Create_Missile_Message)pInstance.obj;
                    CollisionManager.Player     p2    = PlayerManager.getPlayer(smiss.id);
                    p2.createMissile();
                    break;

                case QueueType.ship_rot_anti:
                    Ship_rot_message srmsg = (Ship_rot_message)pInstance.obj;
                    srmsg.rot = -0.1f;
                    srmsg.execute();
                    break;

                case QueueType.ship_bomb:
                    Ship_Create_Bomb_Message smsg = (Ship_Create_Bomb_Message)pInstance.obj;
                    CollisionManager.GameObjManager.Instance().createBomb(smsg.id);
                    break;


                case QueueType.EventMessage:
                    EvenMessage msg = (EvenMessage)pInstance.obj;
                    msg.execute();
                    break;

                case QueueType.ship_rot_clock:
                    Ship_rot_message p3 = (Ship_rot_message)pInstance.obj;
                    p3.rot = 0.1f;
                    p3.execute();
                    break;
                }
            }
        }
Пример #2
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // TODO: use this.Content to load your game content here

                world = new World(new Vector2(0, 0), true);

                myContactListener myContactListener = new myContactListener();

                world.ContactListener = myContactListener;

                Data.Instance().createData();

            if(state != gameState.winner)
                state = gameState.mainmenu;

                player1 = PlayerManager.Instance().getPlayer(PlayerID.one);
                player2 = PlayerManager.Instance().getPlayer(PlayerID.two);

                menuTex = new Text("MainMenu", TextEnum.menu, 0, 20, 20, false, SpriteAnimation.Type.Text_Sprite);
                menuImg = new Image(ImageEnum.menu, 0, 0, 800, 480, menuTex);
                menuSprite = new Sprite(SpriteEnum.menu, 0, 0, 800, 500, false, 0, menuImg, false);
                menuProxy = new Sprite_Proxy(menuSprite, 400, 240, 1, Color.White);
                menuBatch = new SpriteBatch(GraphicsDevice);
        }
 public override void execute()
 {
     CollisionManager.Player p = PlayerManager.getPlayer(this.id);
     p.playerShip.physicsObj.body.ApplyLinearImpulse(this.impulse, p.playerShip.physicsObj.body.GetWorldCenter());
 }
 public ship_impulse(CollisionManager.Player p, Vector2 imp) : base(p.id)
 {
     this.impulse.X = imp.X;
     this.impulse.Y = imp.Y;
 }
 public Ship_Message(CollisionManager.Player pPlayer)
 {
     this.id = pPlayer.id;
 }
 public override void execute()
 {
     CollisionManager.Player p = PlayerManager.getPlayer(this.id);
     p.playerShip.physicsObj.body.Rotation += this.rot;
 }
 public Ship_rot_message(CollisionManager.Player p, float rotation)
     : base(p.id)
 {
     this.rot = rotation;
 }
 public Ship_Create_Bomb_Message(CollisionManager.Player p) : base(p)
 {
 }
Пример #9
0
 public void createPlayers()
 {
     p1 = new Player(PlayerID.one);
     p2 = new Player(PlayerID.two);
 }
Пример #10
0
 private InputManager()
 {
     hdrQueue = new Queue<InputHdr>();
     player1 = PlayerManager.Instance().getPlayer(PlayerID.one);
     player2 = PlayerManager.Instance().getPlayer(PlayerID.two);
 }