/// <summary> /// Initialize scene objects. /// </summary> protected override void InitializeDeviceObjects() { drawingFont.InitializeDeviceObjects(device); spaceSphere = new PositionedMesh(device, "SpaceSphere.x"); HullColors hullColor = HullColors.White; playerShip = new Ship(device, this, hullColor); if (playerShip.HostName == null) { playerShip.HostName = "Player"; } playerShip.State = ShipState.Normal; HullColors opponentHullColor; if (hullColor == HullColors.Red) { opponentHullColor = HullColors.White; } else { opponentHullColor = HullColors.Red; } opponentShip = new Ship(device, this, opponentHullColor); if (opponentShip.HostName == null) { opponentShip.HostName = "Opponent"; } opponentShip.State = ShipState.Normal; }
public GameClass(bool startFullScreen, Size size, bool enableNetwork) { this.startFullscreen = startFullScreen; this.Size = size; this.networkEnabled = enableNetwork; this.Text = "SpaceWar3D-Step11"; statusMessageTimer = Constants.StatusMessageDisplayTime; drawingFont = new GraphicsFont("Verdana", System.Drawing.FontStyle.Regular); input = new InputClass(this); mouseInput = new MouseInput(this); this.MouseMove += new MouseEventHandler(GameClass_MouseMove); this.Cursor = Cursors.NoMove2D; camera = new Camera(); soundHandler = new SoundHandler(this); if (networkEnabled) { peer = new PlayClass(this); if (peer.IsHost) { hullColor = HullColors.Red; } } }
private float waitCount = 6.0f; // wait count before state transition. #endregion Fields #region Constructors public Ship(Device device, GameClass gameClass, HullColors hullColor) { this.device = device; this.game = gameClass; shots = new Shots(device); if (hullColor == HullColors.White) { shipMesh = new PositionedMesh(device, "WhiteShip.x"); startingPosition = new Vector3(10, 0, 10); } else { shipMesh = new PositionedMesh(device, "RedShip.x"); startingPosition = new Vector3(-50, 0, -150); } SetRandomPosition(true); }
public Ship(Device device, GameClass gameClass, HullColors hullColor) { this.device = device; this.game = gameClass; shots = new Shots(device); if (hullColor == HullColors.White) { shipMesh = new PositionedMesh(device, "WhiteShip.x"); startingPosition = new Vector3(10, 0, 10); } else { shipMesh = new PositionedMesh(device, "RedShip.x"); startingPosition = new Vector3(-50, 0, -150); } SetRandomPosition(true); }
private float waitCount = 6.0f; // wait count before state transition. #endregion Fields #region Constructors public Ship(Device device, GameClass gameClass, HullColors hullColor) { this.device = device; this.game = gameClass; shots = new Shots(device); if (hullColor == HullColors.White) { shipMesh = new PositionedMesh(device, "WhiteShip.x"); startingPosition = new Vector3(10, 0, 10); } else { shipMesh = new PositionedMesh(device, "RedShip.x"); startingPosition = new Vector3(-50, 0, -150); } vaporTrail = new ParticleEffects(device); vaporTrail.ParticleTexture = TextureLoader.FromFile(device, MediaUtilities.FindFile("particle-blue.bmp")); SetRandomPosition(true); }
public Ship(Device device, GameClass gameClass, HullColors hullColor) { this.device = device; this.game = gameClass; shots = new Shots(device); if (hullColor == HullColors.White) { shipMesh = new PositionedMesh(device, "WhiteShip.x"); startingPosition = new Vector3(10, 0, 10); } else { shipMesh = new PositionedMesh(device, "RedShip.x"); startingPosition = new Vector3(-50, 0, -150); } vaporTrail = new ParticleEffects(device); vaporTrail.ParticleTexture = TextureLoader.FromFile(device, MediaUtilities.FindFile("particle-blue.bmp")); shockWave = new Shockwave(device); SetRandomPosition(true); }
/// <summary> /// Initialize scene objects. /// </summary> protected override void InitializeDeviceObjects() { drawingFont.InitializeDeviceObjects(device); spaceSphere = new PositionedMesh(device, "SpaceSphere.x"); HullColors hullColor = HullColors.White; playerShip = new Ship(device, this, hullColor); if (playerShip.HostName == null) { playerShip.HostName = "Player"; } playerShip.State = ShipState.Normal; HullColors opponentHullColor; if (hullColor == HullColors.Red) { opponentHullColor = HullColors.White; } else { opponentHullColor = HullColors.Red; } opponentShip = new Ship(device, this, opponentHullColor); if (opponentShip.HostName == null) { opponentShip.HostName = "Opponent"; } opponentShip.State = ShipState.Normal; bgPointer = new BGPointer(device); vectorPanel = TextureLoader.FromFile(device, MediaUtilities.FindFile("vectorPanel.png")); rts = new RenderToSurface(device, 128, 128, Format.X8R8G8B8, true, DepthFormat.D16); }
public GameClass(bool startFullScreen, Size size, bool enableNetwork) { this.startFullscreen = startFullScreen; this.Size = size; this.networkEnabled = enableNetwork; this.Text = "SpaceWar3D-Step12"; statusMessageTimer = Constants.StatusMessageDisplayTime; drawingFont = new GraphicsFont( "Verdana", System.Drawing.FontStyle.Regular); input = new InputClass(this); mouseInput = new MouseInput(this); this.MouseMove +=new MouseEventHandler(GameClass_MouseMove); this.Cursor = Cursors.NoMove2D; camera = new Camera(); soundHandler = new SoundHandler(this); if (networkEnabled) { peer = new PlayClass(this); if (peer.IsHost) { hullColor = HullColors.Red; } } }