private CombatScreen loadScreen(XmlNode backgroundNode) { LHGCamera camera = null; LHGStage stage = null; XmlNodeList childNodes = backgroundNode.ChildNodes; foreach (XmlNode childNode in childNodes) { switch (childNode.Name) { case "camera": camera = loadCamera(childNode); break; case "stage": stage = stageFactory.loadStage(childNode); break; } } CombatScreen screen = new CombatScreen(this.lhg, camera); screen.Initialize(); screen.MyStage = stage; return(screen); }
public GameScreen3D(LunchHourGames lhg, GameScreen.Type type, LHGCamera camera) : base(lhg, type) { this.camera = camera; //Calculate the projection properties float aspectRatio = (float)lhg.GraphicsDevice.Viewport.Width / (float)lhg.GraphicsDevice.Viewport.Height; float fov = MathHelper.PiOver4 * aspectRatio * 3 / 4; projection = Matrix.CreatePerspectiveFieldOfView(fov, aspectRatio, .1f, 10000f); world = Matrix.Identity; }
private LHGCamera loadCamera(XmlNode cameraNode) { LHGCamera camera = new LHGCamera(LHGCameraMode.RollConstrained); camera.OrbitRight(MathHelper.Pi); XmlNodeList cameraChildren = cameraNode.ChildNodes; foreach (XmlNode childNode in cameraChildren) { try { switch (childNode.Name) { case "target": camera.Target = readVector3(childNode); break; case "position": camera.Position = readVector3(childNode); break; case "distance": camera.Distance = (float)Convert.ToDouble(childNode.Attributes["value"].Value); break; case "angle": float angle = (float)Convert.ToDouble(childNode.Attributes["value"].Value); camera.OrbitUp(angle); break; } } catch (Exception ex) { System.Console.WriteLine("CombatFactory.loadCamera - " + ex.Message); } } /* * LHGCamera camera = new LHGCamera(LHGCameraMode.RollConstrained); * * camera.OrbitRight(MathHelper.Pi); * camera.OrbitUp(.32f); * camera.Target = new Vector3(1505f, 0.0f, 470.0f); * camera.Position = new Vector3(1506f, 844f, 2073f); * * camera.Distance = 2000.0f; * */ return(camera); }
private BackgroundPanel background; // 2D Background sprite. The stage is in the front of this (foreground) public CombatScreen(LunchHourGames lhg, LHGCamera camera) : base(lhg, Type.Combat, camera) { this.combatHUD = new CombatHUD(lhg, this); }