public McgLayer( McGrenderStack s, string n ) { stack = s; nodes = new List<McgNode>(); isRendering = true; name = n; }
internal override void Load() { _allowExit = false; Game1 game1 = (Game1)Game1.game; //Vector2[] verts = new [] { // new Vector2 { X = -100, Y = 0 }, // new Vector2 { X = -70, Y = 0 }, // new Vector2 { X = -100, Y = 30 } //}; //Wall _wallTri = new Wall(_world, verts); McgNode rendernode; mcg = new McGrenderStack(); Game1.game.setMcGrender(mcg); mcg.AddLayer("background"); McgLayer l = mcg.GetLayer("background"); /// this is wrong. Rectangle rectTitle = new Rectangle(0, 0, 320, 240); rendernode = l.AddNode( new McgNode(game1.im_title, rectTitle, l, 0, 0) ); }
//internal override string BgBgBg //{ // get // { // return "demon_door_intro"; // } //} internal override void Load() { //_allowExit = false; Game1 game1 = (Game1)Game1.game; //Vector2[] verts = new [] { // new Vector2 { X = -100, Y = 0 }, // new Vector2 { X = -70, Y = 0 }, // new Vector2 { X = -100, Y = 30 } //}; //Wall _wallTri = new Wall(_world, verts); McgNode rendernode; mcg = new McGrenderStack(); Game1.game.setMcGrender(mcg); Texture2D noneMoreBlack = new Texture2D(Game1.game.GraphicsDevice, 1, 1); noneMoreBlack.SetData(new[] { 0xff000000 }); mcg.AddLayer("background"); McgLayer l = mcg.GetLayer("background"); ///// this is wrong. Rectangle rectTitle = new Rectangle(0, 0, 320, 240); rendernode = l.AddNode( new McgNode(noneMoreBlack, rectTitle, l, 0, 0) ); }
public void setMcGrender( McGrenderStack mcg ) { renderstack = mcg; }
/// <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() { // TODO: Add your initialization logic here _.init( this ); main_assembly = System.Reflection.Assembly.GetExecutingAssembly(); // tell the library where to find map scripts global = new SullyGlobalScripts(this); SkillType.initSkillTypes(); Klass.initClasses(); PartyData.InitializePartyData(); Element.initElements(); Status.initStatuses(); Skill.initSkills(); Item.initItems(); Enemy.initEnemies(); init_audio(); mcg = new McGrenderStack(); mcg.AddLayer( "menu" ); mcg.AddLayer( "textbox" ); mcg.AddLayer( "battle_background" ); mcg.AddLayer( "battle_sprites" ); mcg.AddLayer( "battle_ui" ); this.setMcGrender( mcg ); this.game_input_handler = () => { if( this.mainMenu.CanSummonMenu() && action.menu.pressed ) { this.mainMenu.SummonMenu(); } if( this.mainMenu.IsInMenu() ) { this.mainMenu.HandleInput( dir, action ); } if( mainMenu.IsInMenu() ) { return false; } return true; }; Battle.LoadBackgrounds( Content ); boxcolors = new Color[3]; boxcolors[0] = new Color( 0, 0, 0 ); boxcolors[1] = new Color( 112, 112, 112 ); boxcolors[2] = new Color( 144, 144, 144 ); menuColor = new Color( 128,0,128 ); inventory = new Inventory(); saves = new SaveManager(this); Random random = new Random(); foreach( String key in Item.masterItemList.Keys ) { inventory.AddItem( Item.masterItemList[key], random.Next( 1, 98 ) ); } saves = new SaveManager(this); base.Initialize(); }
internal override void Load() { Game1 game1 = (Game1)Game1.game; //Vector2[] verts = new [] { // new Vector2 { X = -100, Y = 0 }, // new Vector2 { X = -70, Y = 0 }, // new Vector2 { X = -100, Y = 30 } //}; //Wall _wallTri = new Wall(_world, verts); McgNode rendernode; Vector2 floor = Coords.Screen2Physics(new Vector2 { X = 0, Y = 215 }); _world = new World(new Vector2 { X = 0, Y = -80 }, floor.Y); Vector2 _666pos = Coords.Screen2Physics(new Vector2 { X = 280, Y = 218 }); Vector2 _666size = Coords.Screen2Physics(new Vector2 { X = 100, Y = 210 }, true); Wall _wall0 = new Wall(_world, -100, 1); Vector2[] verts = new[] { Coords.Screen2Physics(new Vector2 { X = 340, Y = 32 }), Coords.Screen2Physics(new Vector2 { X = 300, Y = 32 }), Coords.Screen2Physics(new Vector2 { X = 300, Y = 200 }), Coords.Screen2Physics(new Vector2 { X = 340, Y = 200 }), }; Wall _wall1 = new Wall(_world, verts); //Wall _wall1 = new Wall(_world, _666pos.X, -1); List<SpriteBasis> civilianList = new List<SpriteBasis>(); for( int i = 0; i < game1.im_civvies.Length; i++ ) { SpriteBasis civSpriteBasis = new SpriteBasis( 16, 16, 7, 7 ); civSpriteBasis.image = game1.im_civvies[i]; civilianList.Add( civSpriteBasis ); } SpriteBasis copSpriteBasis = new SpriteBasis(16, 16, 10, 10); copSpriteBasis.image = game1.im_cop; SpriteBasis bulletSpriteBasis = new SpriteBasis(7, 7, 2, 2); bulletSpriteBasis.image = game1.im_bullet; mcg = new McGrenderStack(); Game1.game.setMcGrender(mcg); mcg.AddLayer( "skybox" ); mcg.AddLayer( "clouds" ); mcg.AddLayer( "background" ); mcg.AddLayer( "corpses" ); mcg.AddLayer( "cars" ); McgLayer l = mcg.GetLayer( "skybox" ); /// this is wrong. Rectangle rectTitle = new Rectangle( 0, 0, 320, 240 ); rendernode = l.AddNode( new McgNode( game1.im_skybox, rectTitle, l, 0, 0 ) ); l = mcg.GetLayer("background"); rendernode = l.AddNode( new McgNode(game1.im_stage, rectTitle, l, 0, 0) ); l = mcg.GetLayer( "clouds" ); for( int i = 0; i < 40; i++ ) { int x = VERGEGame.rand.Next( -400, 350 ); int y = VERGEGame.rand.Next(0,150); int d = VERGEGame.rand.Next(50000,200000); rendernode = l.AddNode( new McgNode( game1.im_clouds[i%9], null, l, x,y ,600,y,d ) ); rendernode.OnStop = ( McgNode node ) => { int x1 = VERGEGame.rand.Next( -400, -100 ); int y1 = VERGEGame.rand.Next( 0, 150 ); int d1 = VERGEGame.rand.Next( 50000, 200000 ); node.SetNewMovement( x1, y1, 400, y1, d1 ); }; } /// this all should be encapsulated eventually. CORPSEMAKER. l = mcg.GetLayer("corpses"); var doorSpriteBasis = new SpriteBasis(38, 24, 5, 5); doorSpriteBasis.image = game1.im_door; var doorSprite = new DoorSprite(doorSpriteBasis); _gun = new DoorController( _world, Coords.Screen2Physics(new Vector2 { X = 32, Y = 206 }), Coords.Screen2Physics(new Vector2 { X = 19, Y = 12 }, true), doorSprite ); _gun.Impulse = new Vector2 { X = -10, Y = 10 }; rendernode = l.AddNode( new McgNode(_gun, l, 60, 200) ); var demonSpriteBasis = new SpriteBasis(9, 19, 7, 7); demonSpriteBasis.image = game1.im_demon; var demonSprite = new DemonSprite( demonSpriteBasis ); _evilDemon = new DemonController( _world, Coords.Screen2Physics(new Vector2 { X = 286, Y = 26 }), Coords.Screen2Physics(new Vector2 { X = 5, Y = 10 }, true), demonSprite ); rendernode = l.AddNode( new McgNode(_evilDemon, l, -1, -1) ); List<WindowController> windowList = new List<WindowController>(); var windowSpriteBasis = new SpriteBasis( 14, 14, 9, 9 ); windowSpriteBasis.image = game1.im_windowbreak; for( int i = 0; i < 6; i++ ) { var windowSprite = new WindowSprite( windowSpriteBasis ); var windowController = new WindowController( _world, Coords.Screen2Physics( new Vector2 { X = 297, Y = ( 53 + ( i * 22 ) + ( i > 1 ? 1 : 0 ) + ( i > 2 ? 1 : 0 ) ) } ), Coords.Screen2Physics( new Vector2 { X = 7, Y = 7 }, true ), windowSprite ); rendernode = l.AddNode( new McgNode( windowController, l, -1, -1 ) ); windowList.Add( windowController ); } windowControllerList = windowList.ToArray(); //spawn guys Vector2 spawnerR = Coords.Screen2Physics(new Vector2 { X = 325, Y = 218 }); var civvieSpawner = new CivvieSpawner( _world, l, spawnerR, TimeSpan.FromSeconds( 2 ), civilianList.ToArray(), 1000 ); l.AddNode(new McgNode(civvieSpawner, l, 80, 20)); //spawn cops var copSpawner = new CopSpawner(_world, l, spawnerR, TimeSpan.FromSeconds(3), copSpriteBasis, bulletSpriteBasis, Coords.Screen2Physics(new Vector2 { X = 286, Y = 26 }),2000); l.AddNode(new McgNode(copSpawner, l, 80, 20)); }