public Chest(Rectangle r, Map m) : base(m) { Body BodyDec = new Body(m.PhysicalWorld); BodyDec.BodyType = BodyType.Static; PolygonShape S = new PolygonShape(1f); S.SetAsBox(r.Width / 2, r.Height / 2); Fixture = BodyDec.CreateFixture(S); Fixture.Restitution = 1f; Fixture.Friction = 10f; Position = r; SetName("Chest"); items = new List <Item>(); ChestWindow = new Window(GeneralManager.GetPartialRect(0.4f, 0.2f, 0.2f, 0.6f)); ChestWindow.BgTex = GeneralManager.Textures["GUI/InGameGUI/ChestMenuBg"]; ChestWindow.Visible = false; CloseButton = new Button(new Rectangle(ChestWindow.Position.Width - 32, 8, 24, 24), "", GeneralManager.Textures["GUI/InGameGUI/CloseButton"], Color.Gray, Color.White, null); CloseButton.Action = CloseChestWindow; ChestWindow.AddGUI(CloseButton); list = new ListBox(new Rectangle(16, 16, ChestWindow.Position.Width - 24, ChestWindow.Position.Height - 32)); ChestWindow.AddGUI(list); Map.Parent.AddGUI(ChestWindow); }
public WorldScreen(Game Game) : base(Game, GeneralManager.ScreenX, GeneralManager.ScreenY) { GeneralManager.LoadAnimation("TestAnim", Vector2.One * 64, 6, 80); GeneralManager.LoadAnimation("PlayerIdle", Vector2.One * 64, 1, 10000); DebugWindow.Visible = false; DebugWindow.AddGUI(FarseerDebugCheck, DebugWindow); AddGUI(DebugWindow); LE = new LightingEngine(); Color a = new Color(ambient, ambient, ambient); LE.SetAmbient(a, a); //LE.SetAmbient(Color.Gray, Color.Gray); Renderer.AddRendererEffect(LE, "LightingEngine"); LoadContent(); Map = new Map(this, tileSize, mapSize); //Renderer.AddPostProcess(new BlurEffect(), "Blur"); SE = new BlurSwitchEffect(); SE.MaxTime = 1f; SE.TurnOffAction = delegate() { Renderer.RemovePostProcess("Switch"); }; Renderer.AddPostProcess(SE, "Switch"); Camera.Init(GeneralManager.GetPartialRect(0, 0, 1, 1), new Rectangle(0, 0, tileSize * mapSize, tileSize * mapSize)); PlayerLight = new SpotLight() { IsEnabled = true, Color = new Vector4(0.9f, .7f, .7f, 1f), Power = .6f, LightDecay = 600, Position = new Vector3(500, 400, 20), SpotAngle = 1.5f, SpotDecayExponent = 3, Direction = new Vector3(0.244402379f, 0.969673932f, 0) }; LE.AddLight(PlayerLight); Debug = new FarseerPhysics.DebugViews.DebugViewXNA(Map.PhysicalWorld); Debug.AppendFlags(FarseerPhysics.DebugViewFlags.Shape); Debug.AppendFlags(FarseerPhysics.DebugViewFlags.AABB); Debug.AppendFlags(FarseerPhysics.DebugViewFlags.PerformanceGraph); Debug.AppendFlags(FarseerPhysics.DebugViewFlags.Joint); Debug.AppendFlags(FarseerPhysics.DebugViewFlags.ContactPoints); Debug.DefaultShapeColor = Color.White; Debug.SleepingShapeColor = Color.LightGray; Debug.LoadContent(Parent.GraphicsDevice, Parent.Content); //Weapon w = new Weapon("test", "Gun", 100, 10, Hands.One, 10, 600, 10, 10, 10); //Serializer.Serialize<Weapon>("weapon.xml", w); }