Esempio n. 1
0
 void Start()
 {
     WallDown = GameObject.FindWithTag("HiddenRoom").GetComponent <WallDown>();
 }
Esempio n. 2
0
        protected override void LoadAssets()
        {
            base.LoadAssets();
            content = new ContentLoader(Content.ServiceProvider, "Content1", "Data/_MAIN/Content");
            ContentLoader content2 = new ContentLoader(Content.ServiceProvider, "Content2", "Data/_MAIN/Content");

            if (!Screen.IsFullHeadless)
            {
                AssetManager.Add(new AssetBuilder <Texture2D>()
                                 .ID("tileset2")
                                 .Create(new GeneralContentProcessor <Texture2D>("Content1", "Images/tileset2"))
                                 .FromContent(content2)
                                 );

                AssetManager.Add(new AssetBuilder <Texture2D>()
                                 .ID("Smoke")
                                 .Create(new GeneralContentProcessor <Texture2D>("Content1", "Images/Smoke"))
                                 .FromContent(content)
                                 );
            }

            AssetManager.Add(new AssetBuilder <SpriteTexture>()
                             .ID("unload_test")
                             .Create(new SpriteTextureProcessor("tileset2", new Rectangle(0, 0, 64, 64)))
                             .FromContent(content2)
                             );

            AssetManager.Add(new AssetBuilder <SpriteTexture>()
                             .ID("floor")
                             .Create(new SpriteTextureProcessor("tileset", new Rectangle(0, 0, 64, 64)))
                             .FromContent(content)
                             );
            AssetManager.Add(new AssetBuilder <SpriteTexture>()
                             .ID("wall_down")
                             .Create(new SpriteTextureProcessor("tileset", new Rectangle(64, 48, 64, 16)))
                             .FromContent(content)
                             );
            AssetManager.Add(new AssetBuilder <SpriteTexture>()
                             .ID("wall_left")
                             .Create(new SpriteTextureProcessor("tileset", new Rectangle(128, 0, 16, 64)))
                             .FromContent(content)
                             );
            AssetManager.Add(new AssetBuilder <SpriteTexture>()
                             .ID("wall_right")
                             .Create(new SpriteTextureProcessor("tileset", new Rectangle(240, 0, 16, 64)))
                             .FromContent(content)
                             );
            AssetManager.Add(new AssetBuilder <SpriteTexture>()
                             .ID("wall_up")
                             .Create(new SpriteTextureProcessor("tileset", new Rectangle(256, 0, 64, 16)))
                             .FromContent(content)
                             );
            AssetManager.Add(new AssetBuilder <SpriteTexture>()
                             .ID("player")
                             .Create(new SpriteTextureProcessor("tileset", new Rectangle(0, 0, 52, 52)))
                             .FromContent(content)
                             );
            AssetManager.Add(new AssetBuilder <SpriteTexture>()
                             .ID("circle")
                             .Create(new SpriteTextureProcessor("tileset", new Rectangle(0, 128, 32, 32)))
                             .FromContent(content)
                             );

            if (!Screen.IsFullHeadless)
            {
                AssetManager.Add(new AssetBuilder <SoundEffect>()
                                 .ID("assaultrifle")
                                 .Create(new GeneralContentProcessor <SoundEffect>("Content1", "assaultrifle"))
                                 .FromContent(content)
                                 );
            }

            AssetManager.Add(new AssetBuilder <Func <Vector2, GameObject> >()
                             .ID("0")
                             .Create(new TileProcessor(pos => {
                Floor obj = new Floor(pos, 0f, Vector2.One);
                obj.GetComponent <Sprite>().Color = Color.White;
                return(obj);
            }))
                             .FromContent(content)
                             );
            AssetManager.Add(new AssetBuilder <Func <Vector2, GameObject> >()
                             .ID("1")
                             .Create(new TileProcessor(pos => {
                WallUp obj = new WallUp(pos, 0f, Vector2.One);
                obj.GetComponent <Sprite>().Color = Color.Red;
                return(obj);
            }))
                             .FromContent(content)
                             );
            AssetManager.Add(new AssetBuilder <Func <Vector2, GameObject> >()
                             .ID("2")
                             .Create(new TileProcessor(pos => {
                WallRight obj = new WallRight(pos, 0f, Vector2.One);
                obj.GetComponent <Sprite>().Color = Color.Blue;
                return(obj);
            }))
                             .FromContent(content)
                             );
            AssetManager.Add(new AssetBuilder <Func <Vector2, GameObject> >()
                             .ID("3")
                             .Create(new TileProcessor(pos => {
                WallDown obj = new WallDown(pos, 0f, Vector2.One);
                obj.GetComponent <Sprite>().Color = Color.Orange;
                return(obj);
            }))
                             .FromContent(content)
                             );
            AssetManager.Add(new AssetBuilder <Func <Vector2, GameObject> >()
                             .ID("4")
                             .Create(new TileProcessor(pos => {
                WallLeft obj = new WallLeft(pos, 0f, Vector2.One);
                obj.GetComponent <Sprite>().Color = Color.Purple;
                return(obj);
            }))
                             .FromContent(content)
                             );
            AssetManager.Add(new AssetBuilder <Func <Vector2, GameObject> >()
                             .ID("5")
                             .Create(new TileProcessor(pos => {
                AnimatedFloor obj = new AnimatedFloor(pos, 0f, Vector2.One);
                obj.GetComponent <Sprite>().Color = Color.White;
                return(obj);
            }))
                             .FromContent(content)
                             );

            //for (int i = 0; i < 50; i++) {
            //    Database.Add<int, Func<Vector2, GameObject>>(6+i, pos => {
            //        AnimatedFloor obj = new AnimatedFloor(pos, 0f, Vector2.One);
            //        //obj.GetComponent<Sprite>().Color = Color.White;
            //        return obj;
            //    });
            //}
        }