예제 #1
0
        private void respawnData(PlayerID _id)
        {
            switch (_id)
            {
            case PlayerID.one:
            {
                Ship p2Ship = PlayerManager.getPlayer(PlayerID.two).playerShip;

                if (p2Ship.spriteRef.pos.Y < 95)
                {
                    Data.Instance().createShip1(new Vector2(150, 130), (float)(90.0f * (Math.PI / 180.0f)));
                }
                else
                {
                    Data.Instance().createShip1(new Vector2(150, 60), -(float)(90.0f * (Math.PI / 180.0f)));
                }
                break;
            }

            case PlayerID.two:
                Ship p1Ship = PlayerManager.getPlayer(PlayerID.one).playerShip;

                if (p1Ship.spriteRef.pos.Y > 95)
                {
                    Data.Instance().createShip2(new Vector2(150, 60), -(float)(90.0f * (Math.PI / 180.0f)));
                }
                else
                {
                    Data.Instance().createShip2(new Vector2(150, 130), (float)(90.0f * (Math.PI / 180.0f)));
                }
                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
            spriteBatch = new SpriteBatch(GraphicsDevice);
            font        = Content.Load <SpriteFont>("SpriteFont1");

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

            world.ContactListener = myContactListener;
            Data.Instance().createData();
            backgroundTexture = Content.Load <Texture2D>("background");
            //backgroundTexture = Content.Load<Texture2D>("MainmenuLobby");
            player1 = PlayerManager.getPlayer(PlayerID.one);
            player2 = PlayerManager.getPlayer(PlayerID.two);
        }
예제 #3
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();

            state = gameState.game;

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

            spriteBatch = new SpriteBatch(GraphicsDevice);

            // font = Content.Load<SpriteFont>("Font");
            font = Content.Load <SpriteFont>("SpriteFont1");
        }