コード例 #1
0
ファイル: LevelEditor.cs プロジェクト: wico-/Code
 public LevelEditor(eContentManager contentMgr)
 {
     contentManager = contentMgr;
     tileTable = new Hashtable();
     players = new List<Player>();
     menuTexture = contentManager.getTexture("crappyMenu");
     replacement = new Artist(new Rectangle(0, 0, 40, 40), contentManager.getTexture("Tiles/engineeringBlock"));
     font = Globals.font;
     selectedTexture = contentManager.getTexture("Tiles/selectedTile");
     blankTile = contentManager.getTexture("Tiles/blankTile");
     tempTiles = new List<Common.Entity>();
     highlightSelection = true;
     textureNames = new List<string>();
     menu = new Menu(menuTexture);
     tiles = new List<Common.Entity>();
     cursorPos = new Vector2();
     highlightTile = new Tile(selectedTexture, new Vector2(0, 0));
     int height = Globals.viewport.Height;
     int width = Globals.viewport.Width;
     int textureWidth = highlightTile.boundary.Width;
     for (int i = 0; i < height; i += 40)
     {
         for (int j = 0; j < width; j += 40)
         {
             tiles.Add(new Tile(blankTile, new Vector2(j, i)));
         }
     }
 }
コード例 #2
0
ファイル: Level.cs プロジェクト: wico-/Code
        public Level(string mapPath)
        {
            contentManager = Globals.contentManager;

            //player = new Artist(new Microsoft.Xna.Framework.Rectangle(500, 500, 40, 40), cm.getTexture("Tiles/Block"));
            background = contentManager.getTexture("background");
            players = new List<Player>();
            activePlayerNumber = 0;
            loadXML(mapPath);
            player = players[activePlayerNumber];
            player.isActive = true;
            foreach (Player p in players)
            {
                if (p is Artist) dots = ((Artist)p).dots;
                if (p is Engineer) blocks = ((Engineer)p).blocks;
            }
        }
コード例 #3
0
ファイル: eContentManager.cs プロジェクト: wico-/Code
 public static eContentManager getInstance(ContentManager contentMgr)
 {
     if (instance == null) instance = new eContentManager(contentMgr);
     return instance;
 }
コード例 #4
0
ファイル: Menu.cs プロジェクト: wico-/Code
 public void LoadContent(eContentManager contentManager)
 {
     tiles.Add(new Tile(contentManager.getTexture("Tiles/engineeringBlock"), new Vector2(1, 1)));
     tiles.Add(new Tile(contentManager.getTexture("Tiles/rockTile"), new Vector2(1, 1)));
     tiles.Add(new Tile(contentManager.getTexture("Tiles/leopardTile"), new Vector2(1, 1)));
     tiles.Add(new Tile(contentManager.getTexture("Tiles/starsTile"), new Vector2(1, 1)));
     tiles.Add(new Tile(contentManager.getTexture("Tiles/spikes"), new Vector2(1, 1)));
     tiles.Add(new Tile(contentManager.getTexture("Tiles/tiles"), new Vector2(1, 1)));
     tiles.Add(new Tile(contentManager.getTexture("Tiles/Block"), new Vector2(1, 1)));
     buttons.Add(new Button(contentManager.getTexture("Buttons/Button"), "Play Map"));
     buttons.Add(new Button(contentManager.getTexture("Buttons/Button"), "Save Map"));
 }
コード例 #5
0
ファイル: Game1.cs プロジェクト: wico-/Code
 /// <summary>
 /// Allows the game to perform any initialization it needs to before starting to run.
 /// This is where it can query for any required services and load any non-graphic
 /// related content.  Calling base.Initialize will enumerate through any components
 /// and initialize them as well.
 /// </summary>
 protected override void Initialize()
 {
     this.IsMouseVisible = true;
     ground = GraphicsDevice.Viewport.TitleSafeArea.Height - 40;
     camera = new Camera(viewport);
     contentManager = eContentManager.getInstance(this.Content);
     Globals.contentManager = eContentManager.getInstance();
     Globals.viewport = viewport;
     Globals.font = contentManager.getSpriteFont("myFont");
     //level = new Level(Content.RootDirectory + "/Maps/serializeTest.xml");
     inputManager = new InputHandler.InputManager();
     mainMenu = new MainMenu(LevelManager.LevelManager.LEVEL_DIR);
     base.Initialize();
 }