Exemplo n.º 1
0
 public Mouse(MouseManager mouse)
 {
     _mouse = mouse;
     mouse.Initialize();
     MouseManager = mouse;
     Left         = new Key();
     Right        = new Key();
     Middle       = new Key();
 }
Exemplo n.º 2
0
        protected override void LoadContent()
        {
            //Initialize the GameInfo:
            GameInfo.RefSpriteBatch   = spriteBatch;
            GameInfo.RefDevice        = Device;
            GameInfo.RefDeviceManager = graphics;
            GameInfo.RefContent       = Content;

            //Initialize some more static classes:
            TextureHolder.Initialize();
            SoundHolder.Initialize();
            MouseManager.Initialize();

            //Initalize the grid:
            Grid grid      = new Grid(new Vector2(0, 0), 100, 40);
            Grid gridFloor = new Grid(new Vector2(0, 0), 100, 40);

            ObjectHolder.Create(grid);
            ObjectHolder.Create(gridFloor);

            //Initialize the camera:
            Camera.Initialize(new Vector2(0, 0));

            //Initialize default sprites:
            TextureHolder.DefaultTextures[typeof(DungeonWall)]   = TextureHolder.AddTexture("DungeonWall");
            TextureHolder.DefaultTextures[typeof(DungeonFloor)]  = TextureHolder.AddTexture("DungeonFloor");
            TextureHolder.DefaultTextures[typeof(DungeonFloor2)] = TextureHolder.AddTexture("DungeonFloor2");
            TextureHolder.DefaultTextures[typeof(Player)]        = TextureHolder.AddTexture("Player");
            TextureHolder.DefaultTextures[typeof(PlayerLegs)]    = TextureHolder.AddTexture("PlayerLegs");
            TextureHolder.DefaultTextures[typeof(PlayerSword)]   = TextureHolder.AddTexture("PlayerSword");
            TextureHolder.DefaultTextures[typeof(CannonBot)]     = TextureHolder.AddTexture("CannonBot");
            TextureHolder.DefaultTextures[typeof(Sink)]          = TextureHolder.AddTexture("Sink");

            //Load sounds:

            //Create game objects:
            gridFloor.CreateFromString( //Make the floor
                new Dictionary <char, Type>()
            {
                { 'f', typeof(DungeonFloor) },
                { 's', typeof(DungeonFloor2) },
                { '.', null }
            },
                new Dictionary <char, GameObject>()
            {
            },
                new string[] {
                "..............",
                ".sfffffffffff.",
                ".ffffffffffff.",
                ".ffffffffffff..........",
                ".fffffffffffffffsfffff.",
                ".fffffffsfffffffffffff.",
                ".fffffffffffffffffffff.",
                ".fffffffffffffffffffff.",
                ".ffffffffffff..........",
                ".fffsffffffff.",
                ".ffffffffffff.",
                ".............."
            });

            grid.CreateFromString(
                new Dictionary <char, Type>()
            {
                { 'w', typeof(DungeonWall) },
                { 'p', typeof(Player) },
                { 'c', typeof(CannonBot) },
                { 's', typeof(Sink) },
                { '.', null }
            },
                new Dictionary <char, GameObject>()
            {
                { '1', new Sink(new Vector2(0, 0), MazeGameEngine.FurnitureDirection.Up) }
            },
                new string[] {
                "wwwwwwwwwwwwww",
                "w............w",
                "w............w",
                "w............wwwwwwwwww",
                "w.....................w",
                "w.....p...............w",
                "w.....................w",
                "w.....................w",
                "w............wwwwwwwwww",
                "w............w",
                "w.....1......w",
                "wwwwwwwwwwwwww"
            });

            //Make a reference to the UI objects: (so that other objects can interact with them)
        }