public static Level ReadFile(BinaryReader Reader) { Level NewLevel = new Level(ReadRectangle(Reader), new Camera(ReadVector4(Reader))); NewLevel.MyCamera.EditorOffset = ReadVector2(Reader); int ObjectCount = Reader.ReadInt32(); NewLevel.ObjectList = new List <BasicObject>(ObjectCount); for (int i = 0; i < ObjectCount; i++) { BasicObject NewObject = Instancer.CreateInstanceOf(Reader.ReadString(), NewLevel); NewObject.Create(Vector2.Zero, Vector2.Zero); // if (NewObject != null) { NewObject.PreRead(Reader); NewObject.Read(Reader); } } try { NewLevel.MyBackground = BackgroundBasic.ReturnBackground(Reader.ReadInt32()); } catch (Exception e) { } return(NewLevel); }
public Level(Rectangle MyRectangle, Camera MyCamera) { MyBackground = new SpaceBack().Create(0); RedGlow = Game1.contentManager.Load <Texture2D>("Game/RedGlow"); MyTimeManager = new TimeManager().Create(this); this.MyRectangle = MyRectangle; this.MyCamera = MyCamera; TimeRectangle = new Rectangle(0, 0, 1000000, 640); UpdateResize(); LevelEffect = Game1.contentManager.Load <Effect>("Game/Backgrounds/LevelEffect"); CountFont = Game1.contentManager.Load <SpriteFont>("Game/CountFont"); }
void SelectCave(Button button) { DeselectButtons(); button.Selected = true; GameManager.MyLevel.MyBackground = BackgroundBasic.ReturnBackground(2); }