public void LoadAssets() { // Load textures foregroundTexture = Load<Texture2D>("Textures/Backgrounds/gameplay_screen"); cloud1Texture = Load<Texture2D>("Textures/Backgrounds/cloud1"); cloud2Texture = Load<Texture2D>("Textures/Backgrounds/cloud2"); mountainTexture = Load<Texture2D>("Textures/Backgrounds/mountain"); skyTexture = Load<Texture2D>("Textures/Backgrounds/sky"); defeatTexture = Load<Texture2D>("Textures/Backgrounds/defeat"); victoryTexture = Load<Texture2D>("Textures/Backgrounds/victory"); hudBackgroundTexture = Load<Texture2D>("Textures/HUD/hudBackground"); windArrowTexture = Load<Texture2D>("Textures/HUD/windArrow"); ammoTypeTexture = Load<Texture2D>("Textures/HUD/ammoType"); // Load font hudFont = Load<SpriteFont>("Fonts/HUDFont"); // Define initial cloud position cloud1Position = new Vector2(224 - cloud1Texture.Width, 32); cloud2Position = new Vector2(64, 90); // Define initial HUD positions playerHUDPosition = new Vector2(7, 7); computerHUDPosition = new Vector2(613, 7); windArrowPosition = new Vector2(345, 46); // Initialize human & AI players player = new Human(ScreenManager.Game, ScreenManager.SpriteBatch); player.Initialize(); player.Name = "Player"; computer = new AI(ScreenManager.Game, ScreenManager.SpriteBatch); computer.Initialize(); computer.Name = "Phone"; // Identify enemies player.Enemy = computer; computer.Enemy = player; }
void SendCatapultInfo (MessageType messageType, Human player) { packetWriter.Write((int)messageType); catapultInfoVector.X = player.Catapult.ShotStrength; catapultInfoVector.Y = player.Catapult.ShotVelocity; catapultInfoVector.Z = player.ArrowScale; packetWriter.Write(catapultInfoVector); // Update our locally controlled catapults, and send their // latest position data to everyone in the session. foreach (LocalNetworkGamer gamer in NetworkSession.LocalGamers) { gamer.SendData(packetWriter, SendDataOptions.ReliableInOrder); } }
public void LoadAssets() { // Load textures foregroundTexture = Load<Texture2D>("Textures/Backgrounds/gameplay_screen"); cloud1Texture = Load<Texture2D>("Textures/Backgrounds/cloud1"); cloud2Texture = Load<Texture2D>("Textures/Backgrounds/cloud2"); mountainTexture = Load<Texture2D>("Textures/Backgrounds/mountain"); skyTexture = Load<Texture2D>("Textures/Backgrounds/sky"); defeatTexture = Load<Texture2D>("Textures/Backgrounds/defeat"); victoryTexture = Load<Texture2D>("Textures/Backgrounds/victory"); hudBackgroundTexture = Load<Texture2D>("Textures/HUD/hudBackground"); windArrowTexture = Load<Texture2D>("Textures/HUD/windArrow"); ammoTypeTexture = Load<Texture2D>("Textures/HUD/ammoType"); // Load font hudFont = Load<SpriteFont>("Fonts/HUDFont"); // Define initial cloud position cloud1Position = new Vector2(224 - cloud1Texture.Width, 32); cloud2Position = new Vector2(64, 90); // Define initial HUD positions playerHUDPosition = new Vector2(7, 7); computerHUDPosition = new Vector2(613, 7); windArrowPosition = new Vector2(345, 46); // Initialize human & AI players player = new Human(ScreenManager.Game, ScreenManager.SpriteBatch); player.Initialize(); player.Name = "Player"; computer = new AI(ScreenManager.Game, ScreenManager.SpriteBatch); computer.Initialize(); computer.Name = "Phone"; // Identify enemies player.Enemy = computer; computer.Enemy = player; base.LoadContent(); if (PhoneApplicationService.Current.StartupMode == StartupMode.Activate) { player.Score = int.Parse(PhoneApplicationService.Current.State["playerScore"].ToString()); computer.Score = int.Parse(PhoneApplicationService.Current.State["computerScore"].ToString()); isHumanTurn = !bool.Parse(PhoneApplicationService.Current.State["isHumanTurn"].ToString()); wind = Vector2.Zero; changeTurn = true; computer.Catapult.CurrentState = CatapultState.Reset; } else // Start the game Start(); }
public void LoadAssets () { NetworkSession = ScreenManager.Game.Services.GetService (typeof(NetworkSession)) as NetworkSession; IsNetworking = NetworkSession != null; // Load textures foregroundTexture = Load<Texture2D> ("Textures/Backgrounds/gameplay_screen"); cloud1Texture = Load<Texture2D> ("Textures/Backgrounds/cloud1"); cloud2Texture = Load<Texture2D> ("Textures/Backgrounds/cloud2"); mountainTexture = Load<Texture2D> ("Textures/Backgrounds/mountain"); skyTexture = Load<Texture2D> ("Textures/Backgrounds/sky"); defeatTexture = Load<Texture2D> ("Textures/Backgrounds/defeat"); victoryTexture = Load<Texture2D> ("Textures/Backgrounds/victory"); hudBackgroundTexture = Load<Texture2D> ("Textures/HUD/hudBackground"); windArrowTexture = Load<Texture2D> ("Textures/HUD/windArrow"); ammoTypeTexture = Load<Texture2D> ("Textures/HUD/ammoType"); // Load font hudFont = Load<SpriteFont> ("Fonts/HUDFont"); // Define initial cloud position cloud1Position = new Vector2 (224 - cloud1Texture.Width, 32); cloud2Position = new Vector2 (64, 90); // Define initial HUD positions playerOneHUDPosition = new Vector2 (7, 7); computerHUDPosition = new Vector2 (613, 7); windArrowPosition = new Vector2 (345, 46); // Initialize human & other players if (IsNetworking) { if (NetworkSession.RemoteGamers.Count > 0) { if (NetworkSession.IsHost) { playerOne = new Human (ScreenManager.Game, ScreenManager.SpriteBatch, PlayerSide.Left); playerOne.Initialize (); playerOne.Name = NetworkSession.LocalGamers [0].Gamertag + " (host)"; playerTwo = new Human (ScreenManager.Game, ScreenManager.SpriteBatch, PlayerSide.Right); playerTwo.Initialize (); playerTwo.Name = NetworkSession.RemoteGamers [0].Gamertag; } else { playerOne = new Human (ScreenManager.Game, ScreenManager.SpriteBatch, PlayerSide.Left); playerOne.Initialize (); playerOne.Name = NetworkSession.RemoteGamers [0].Gamertag + " (host)"; playerTwo = new Human (ScreenManager.Game, ScreenManager.SpriteBatch, PlayerSide.Right); playerTwo.Initialize (); playerTwo.Name = NetworkSession.LocalGamers [0].Gamertag; } } else { playerOne = new Human (ScreenManager.Game, ScreenManager.SpriteBatch, PlayerSide.Left); playerOne.Initialize (); playerOne.Name = NetworkSession.LocalGamers [0].Gamertag + " (host)"; playerTwo = new Human (ScreenManager.Game, ScreenManager.SpriteBatch, PlayerSide.Right); playerTwo.Initialize (); playerTwo.Name = "Player 2"; IsNetworking = false; NetworkSession.Dispose(); NetworkSession = null; } } else { playerOne = new Human (ScreenManager.Game, ScreenManager.SpriteBatch, PlayerSide.Left); playerOne.Initialize (); playerOne.Name = "Player 1"; playerTwo = new AI (ScreenManager.Game, ScreenManager.SpriteBatch); playerTwo.Initialize (); playerTwo.Name = "Player 2"; } // Identify enemies playerOne.Enemy = playerTwo; playerTwo.Enemy = playerOne; }