コード例 #1
0
ファイル: Block.cs プロジェクト: kratosaurion7/Pung
 public Block(PungGame game)
     : base(game)
 {
     // Create a new block without knowledge of the safe zone so it can be will be placed anywhere randomly.
     position = new Vector2(Utilities.Randomizer.CreateRandom(0, Game.Window.ClientBounds.Width),
         Utilities.Randomizer.CreateRandom(0, Game.Window.ClientBounds.Height));
 }
コード例 #2
0
ファイル: Block.cs プロジェクト: kratosaurion7/Pung
 public Block(PungGame game, Rectangle spawnZone)
     : base(game)
 {
     // Start the block at a random position within the block spawning zone.
     position = new Vector2(Utilities.Randomizer.CreateRandom(spawnZone.X, spawnZone.Width),
         Utilities.Randomizer.CreateRandom(spawnZone.Y, spawnZone.Height));
 }
コード例 #3
0
ファイル: Program.cs プロジェクト: kratosaurion7/Pung
 /// <summary>
 /// The main entry point for the application.
 /// </summary>
 static void Main(string[] args)
 {
     using (PungGame game = new PungGame())
     {
         game.Run();
     }
 }
コード例 #4
0
ファイル: GameObject.cs プロジェクト: kratosaurion7/Pung
        public GameObject(PungGame game)
            : base(game)
        {
            position = new Vector2();

            spriteBatch = (SpriteBatch)Game.Services.GetService(typeof(SpriteBatch));
        }
コード例 #5
0
ファイル: BlockManager.cs プロジェクト: kratosaurion7/Pung
        /// <summary>
        /// Add a block with a random block size to the game field and place it randomly 
        /// </summary>
        /// <param name="game">Reference to the game.</param>
        public void addBlock(PungGame game)
        {
            // Create a new empty block, only his position is known at start.
            Block newBlock = new Block(game, blocksSafeZone);

            // Call the overloaded addBlock procedure to generate a texture and affect his objectRectangle
            addBlock(newBlock,
                Utilities.Randomizer.CreateRandom(MIN_BLOCK_SIZE, MAX_BLOCK_SIZE),
                Utilities.Randomizer.CreateRandom(MIN_BLOCK_SIZE, MAX_BLOCK_SIZE),
                new Color(255, 0, 0));
        }
コード例 #6
0
ファイル: Player.cs プロジェクト: kratosaurion7/Pung
 /// <summary>
 /// Create a new instance of the Player class.
 /// </summary>
 /// <param name="game"></param>
 /// <param name="playerNumber"></param>
 public Player(PungGame game, Pallet.PlayerNumber playerNumber)
 {
     pallet = new Pallet(game, playerNumber);
 }
コード例 #7
0
ファイル: Block.cs プロジェクト: kratosaurion7/Pung
 /// <summary>
 /// Constructor used to instance a block at a particular position rather than a random one.
 /// </summary>
 /// <param name="game">Reference to the main Game class.</param>
 /// <param name="startingPosition">Position to spawn the block.</param>
 public Block(PungGame game, Vector2 startingPosition)
     : base(game)
 {
     position = startingPosition;
 }
コード例 #8
0
ファイル: BlockManager.cs プロジェクト: kratosaurion7/Pung
 public BlockManager(PungGame game)
     : base(game)
 {
     blocksList = new List<Block>();
 }
コード例 #9
0
ファイル: Pallet.cs プロジェクト: kratosaurion7/Pung
 /// <summary>
 /// Create a new instance of the Pallet class using the game reference and a player number.
 /// </summary>
 /// <param name="game">Reference to the game class.</param>
 /// <param name="playerNumber">Player number.</param>
 public Pallet(PungGame game, PlayerNumber playerNumber)
     : base(game)
 {
     playerIndex = playerNumber; // Associate the pallet to a player using it's player number.
 }