Example #1
0
        public MemoryState(string name)
            : base(name)
        {
            Player = G.Player;

            Items = new List<GameItem>();
            Hotspots = new List<Hotspot>();
            ItemsToLeave = new List<string>();
            ItemsToRemember = new List<string>();
            Lights = new List<Sprite>();

            Camera = new CameraSingle (G.SCREEN_WIDTH, G.SCREEN_HEIGHT);

            InventoryButton = new Hotspot(
                "Open Inventory",
                new Rectagon(10, 5, 18, 55),
                (t,i) =>
                {
                    G.InventoryManager.IsShown = !G.InventoryManager.IsShown;

                    InventoryButton.Rotation = G.InventoryManager.IsShown ?
                        -MathHelper.PiOver2
                        : MathHelper.PiOver2;

                    InventoryButton.Location.Y += G.InventoryManager.IsShown
                        ? G.InventoryManager.Bounds.Bottom + 25
                        : -G.InventoryManager.Bounds.Bottom - 25;

                    InventoryButton.Name = G.InventoryManager.IsShown
                        ? "Close Inventory"
                        : "Open Inventory";

                }) {EnforceDistance = false};

            Hotspots.Add (InventoryButton);
        }
Example #2
0
        protected override void LoadContent()
        {
            Content.RootDirectory = "Content";

            Graphics.PreferredBackBufferWidth = SCREEN_WIDTH;
            Graphics.PreferredBackBufferHeight = SCREEN_HEIGHT;
            Graphics.IsFullScreen = false;
            Graphics.ApplyChanges();

            IsMouseVisible = true;
            Debug = new CollisionRenderer (GraphicsDevice);
            StateManager = new StateManager();
            SpriteBatch = new SpriteBatch (GraphicsDevice);
            C = Content;
            BloomRenderer = new BloomComponent(this);
            BloomRenderer.LoadContent();
            InventoryManager = new InventoryManager();

            DialogFont = C.Load<SpriteFont> ("fonts/debug");
            HoverFont = C.Load<SpriteFont> ("fonts/debug");

            DialogManager = new DialogManager
            {
                MessageBounds = new Rectangle(15, 15 + (int)InventoryManager.Bounds.Bottom, SCREEN_WIDTH, 300),
                Font = DialogFont,
            };

            Player = new Player();

            StateManager.Add (new TentState());
            StateManager.Add (new CampState());
            StateManager.Add (new ForestState());
            StateManager.Set ("Tent");

            Activated += (s, a) => Active = true;
            Deactivated += (s, a) => Active = false;

            FadeIn = new ColorTransition (Graphics.GraphicsDevice, SCREEN_WIDTH, SCREEN_HEIGHT, 0.45f, Color.Black, Color.Transparent);
            FadeOut = new ColorTransition (Graphics.GraphicsDevice, SCREEN_WIDTH, SCREEN_HEIGHT, 0.45f, Color.Transparent, Color.Black);
        }