Esempio n. 1
0
 /// <summary>
 /// LoadContent will be called once per game and is the place to load
 /// all of your content.
 /// </summary>
 protected override void LoadContent()
 {
     // Create a new SpriteBatch, which can be used to draw textures.
     spriteBatch               = new SpriteBatch(GraphicsDevice);
     mainUIFont                = Content.Load <SpriteFont>(@"MainUIFont");
     multiplayerLobbyTest      = new TextSprite(mainUIFont, new Vector2(50, 50), "", Color.White, 1, Constant.l_diceDescript);
     multiplayerLobbyTest.text = "";
     boardTileTextures         = Content.Load <Texture2D>(@"Sprites\\iso_grass_tileset");
     Constant.t_icons          = Content.Load <Texture2D>(@"Sprites\\iconTextures");
     //board = new BattleBoard(
     //    boardTileTextures,
     //    mainUIFont,
     //    new Vector2(320,-192),
     //    12,
     //    player1,
     //    player2,
     //    new Vector2(this.Window.ClientBounds.Width, this.Window.ClientBounds.Height));
     //test
     // TODO: use this.Content to load your game content here
 }
        /// <summary>
        /// Creates an array of floortiles having varying tile nos.
        /// Location starts from topTileLoc and go to boardsize * 32.
        /// </summary>
        /// <param name="floorTileSet"></param>
        /// <param name="topTileLocation"></param>
        /// <param name="boardSize"></param>
        public BattleBoard(Texture2D floorTileSet, SpriteFont font, Vector2 topTileLocation, int boardSize, Player Player1, Player Player2, GameClient Client, Vector2 screenSize)
        {
            int tileNo = 0;

            inputMoveIndex       = 0;
            spellPlayingIndex    = 0;
            spellUseDisplayTimer = 0;
            isCurrentSpellUsed   = false;
            client        = Client;
            currentState  = State.Input;
            inputState    = InputState.Waiting;
            abilityInputs = new List <AbilityInput>(movesPerTurn);
            activeEffects = new List <AbilityInput>();
            spellPlayList = new List <AbilityInput>();
            for (int i = 0; i < movesPerTurn; i++)
            {
                abilityInputs.Add(new AbilityInput());
            }
            topTileLoc         = topTileLocation;
            highLightedTiles   = new List <FloorTile>();
            loggedInPlayer     = Player1;
            opponentPlayer     = Player2;
            dicemanDescription = new TextSprite(font, Constant.v_diceDescript, "", Color.White, 1f, Constant.l_diceDescript);
            abilityDescription = new TextSprite(font, screenSize + Constant.v_abilityDescriptOffset, "", Color.White, 1f, Constant.l_diceDescript);
            board = new FloorTile[boardSize, boardSize];
            for (int i = 0; i < boardSize; i++)
            {
                for (int j = 0; j < boardSize; j++)
                {
                    if (RandomGenerator.Random.NextDouble() < 0.2)
                    {
                        tileNo = (tileNo + 1) % 8;
                    }
                    board[i, j] = new FloorTile(floorTileSet, tileNo, new Vector2(topTileLocation.X + i * 32, topTileLocation.Y + j * 32));
                }
            }
        }