public static void Initialise(InsoGame game) { Matrix projection = Matrix.CreateOrthographicOffCenter(0, game.ScreenWidth, game.ScreenHeight, 0, 0, 1); Matrix halfPixelOffset = Matrix.CreateTranslation(-0.5f, -0.5f, 0); baseEffect = game.Content.Load <Effect>("Effects/Flash"); //customEffect.Parameters["World"].SetValue(Matrix.Identity); //customEffect.Parameters["View"].SetValue(Matrix.Identity); //customEffect.Parameters["Projection"].SetValue(halfPixelOffset * projection); Vector2 focusPoint = new Vector2(Globals.TheGame.ScreenWidth * 0.5f, Globals.TheGame.ScreenHeight * 0.5f); cam_Main = new Camera2D(focusPoint); cam_Main.ScaleToZoom = true; for (int i = 0; i < backgroundZoomLevels.Length; ++i) { backgroundZoomLevels[i] = (BaseBgZoom + (float)(i + 1) / (float)backgroundZoomLevels.Length) + ExtraBgZoom; } cam_BgBack = new Camera2D(focusPoint); cam_BgBack.ScaleToZoom = true; cam_BgBack.Transform.ScaleUniform = 0.25f; cam_BgBack.Transform.ParentTransform = cam_Main.Transform; cam_BgMiddle = new Camera2D(focusPoint); cam_BgMiddle.ScaleToZoom = true; cam_BgMiddle.Transform.ScaleUniform = 0.5f; cam_BgMiddle.Transform.ParentTransform = cam_Main.Transform; cam_BgFront = new Camera2D(focusPoint); cam_BgFront.ScaleToZoom = true; cam_BgFront.Transform.ScaleUniform = 0.75f; cam_BgFront.Transform.ParentTransform = cam_Main.Transform; UL_Global = new UpdateList(); DL_EarthTiles = new DrawingList(); DL_House = new DrawingList(); DL_GroundItems = new DrawingList(); DL_MiddleGround = new DrawingList(); DL_BgLayers[0] = new DrawingList(); DL_BgLayers[1] = new DrawingList(); DL_BgLayers[2] = new DrawingList(); DL_ItemDrops = new DrawingList(); DL_Foreground = new DrawingList(); DL_Backpackers = new DrawingList(); }
public List <GameObject> Spawn(UpdateList updateList, DrawingList drawingList) { List <GameObject> spawned = new List <GameObject>(); GameObject gameObject; for (int i = 0; i < m_spawners.Length; ++i) { Type typeToSpawn = GetTypeToSpawn(m_spawners[i].SectionRatio); if (typeToSpawn == null) { continue; } gameObject = m_spawners[i].Spawn(typeToSpawn); spawned.Add(gameObject); updateList.Add(gameObject, 0); drawingList.Add(gameObject, 0); } return(spawned); }
public GameObject(GameObject objectToCopy) { m_transform = new Transform(objectToCopy.Transform); if (objectToCopy.Sprite != null) m_sprite = new Sprite(objectToCopy.Sprite, m_transform); if (objectToCopy.Physics != null) m_physics = new PhysicsComponent(objectToCopy.Physics, m_transform); //if (objectToCopy.Destructible != null) // m_physics = new DestructibleComponent(objectToCopy.Destructible, m_transform); if (objectToCopy.m_updateList != null) m_updateList = objectToCopy.m_updateList; if (objectToCopy.m_drawingList != null) m_drawingList = objectToCopy.m_drawingList; if (objectToCopy.m_spawners != null) { m_spawners = new List<Spawner>(); for (int i = 0; i < objectToCopy.m_spawners.Count; ++i) m_spawners.Add(new Spawner(m_spawners[i])); } }
public static void Initialise(InsoGame game) { Matrix projection = Matrix.CreateOrthographicOffCenter(0, game.ScreenWidth, game.ScreenHeight, 0, 0, 1); Matrix halfPixelOffset = Matrix.CreateTranslation(-0.5f, -0.5f, 0); baseEffect = game.Content.Load<Effect>("Effects/Flash"); //customEffect.Parameters["World"].SetValue(Matrix.Identity); //customEffect.Parameters["View"].SetValue(Matrix.Identity); //customEffect.Parameters["Projection"].SetValue(halfPixelOffset * projection); Vector2 focusPoint = new Vector2(Globals.TheGame.ScreenWidth * 0.5f, Globals.TheGame.ScreenHeight * 0.5f); cam_Main = new Camera2D(focusPoint); cam_Main.ScaleToZoom = true; for (int i = 0; i < backgroundZoomLevels.Length; ++i) backgroundZoomLevels[i] = (BaseBgZoom + (float)(i + 1) / (float)backgroundZoomLevels.Length) + ExtraBgZoom; cam_BgBack = new Camera2D(focusPoint); cam_BgBack.ScaleToZoom = true; cam_BgBack.Transform.ScaleUniform = 0.25f; cam_BgBack.Transform.ParentTransform = cam_Main.Transform; cam_BgMiddle = new Camera2D(focusPoint); cam_BgMiddle.ScaleToZoom = true; cam_BgMiddle.Transform.ScaleUniform = 0.5f; cam_BgMiddle.Transform.ParentTransform = cam_Main.Transform; cam_BgFront = new Camera2D(focusPoint); cam_BgFront.ScaleToZoom = true; cam_BgFront.Transform.ScaleUniform = 0.75f; cam_BgFront.Transform.ParentTransform = cam_Main.Transform; UL_Global = new UpdateList(); DL_EarthTiles = new DrawingList(); DL_House = new DrawingList(); DL_GroundItems = new DrawingList(); DL_MiddleGround = new DrawingList(); DL_BgLayers[0] = new DrawingList(); DL_BgLayers[1] = new DrawingList(); DL_BgLayers[2] = new DrawingList(); DL_ItemDrops = new DrawingList(); DL_Foreground = new DrawingList(); DL_Backpackers = new DrawingList(); }
public List<GameObject> Spawn(UpdateList updateList, DrawingList drawingList) { List<GameObject> spawned = new List<GameObject>(); GameObject gameObject; for (int i = 0; i < m_spawners.Length; ++i) { Type typeToSpawn = GetTypeToSpawn(m_spawners[i].SectionRatio); if (typeToSpawn == null) continue; gameObject = m_spawners[i].Spawn(typeToSpawn); spawned.Add(gameObject); updateList.Add(gameObject, 0); drawingList.Add(gameObject, 0); } return spawned; }