Exemplo n.º 1
0
        public void Initialize(GraphicsDevice graphics, ContentManager content)
        {
            if (!m_initialized)
            {
                Texture2D spriteSheet = TextureManager.GetTexture(ContentPaths.Entities.Furniture.bedtex);
                OldBoxPrimitive.BoxTextureCoords boxCoords = new OldBoxPrimitive.BoxTextureCoords(spriteSheet.Width, spriteSheet.Height,
                                                                                                  new OldBoxPrimitive.FaceData(new Rectangle(0, 24, 24, 16), true),
                                                                                                  new OldBoxPrimitive.FaceData(new Rectangle(72, 24, 24, 16), true),
                                                                                                  new OldBoxPrimitive.FaceData(new Rectangle(24, 0, 48, 24), false),
                                                                                                  new OldBoxPrimitive.FaceData(new Rectangle(0, 0, 1, 1), true),
                                                                                                  new OldBoxPrimitive.FaceData(new Rectangle(24, 24, 48, 16), true),
                                                                                                  new OldBoxPrimitive.FaceData(new Rectangle(24, 40, 48, 16), true));
                BoxPrimitives["bed"] = new OldBoxPrimitive(graphics, 0.8f, 0.5f, 1.8f, boxCoords);

                Texture2D bookSheet = TextureManager.GetTexture(ContentPaths.Entities.Furniture.bookshelf);
                OldBoxPrimitive.BoxTextureCoords bookshelfTexture = new OldBoxPrimitive.BoxTextureCoords(bookSheet.Width, bookSheet.Height,
                                                                                                         new OldBoxPrimitive.FaceData(new Rectangle(0, 20, 20, 32), true),
                                                                                                         new OldBoxPrimitive.FaceData(new Rectangle(28, 20, 20, 32), true),
                                                                                                         new OldBoxPrimitive.FaceData(new Rectangle(20, 0, 8, 20), false),
                                                                                                         new OldBoxPrimitive.FaceData(new Rectangle(0, 0, 1, 1), true),
                                                                                                         new OldBoxPrimitive.FaceData(new Rectangle(20, 20, 8, 32), true),
                                                                                                         new OldBoxPrimitive.FaceData(new Rectangle(20, 52, 8, 32), true));
                BoxPrimitives["bookshelf"] = new OldBoxPrimitive(graphics, 20.0f / 32.0f, 32.0f / 32.0f, 8.0f / 32.0f, bookshelfTexture);

                m_initialized = false;


                Texture2D sheetTiles = TextureManager.GetTexture(ContentPaths.Terrain.terrain_tiles);
                OldBoxPrimitive.BoxTextureCoords crateCoords = new OldBoxPrimitive.BoxTextureCoords(sheetTiles.Width, sheetTiles.Height, 32, 32,
                                                                                                    new Point(7, 0),
                                                                                                    new Point(7, 0),
                                                                                                    new Point(8, 0),
                                                                                                    new Point(7, 0),
                                                                                                    new Point(7, 0),
                                                                                                    new Point(7, 0));
                BoxPrimitives["crate"] = new OldBoxPrimitive(graphics, 0.9f, 0.9f, 0.9f, crateCoords);
                m_initialized          = false;

                List <Matrix> treeTransforms = new List <Matrix>();
                List <Color>  treeTints      = new List <Color>();
                treeTransforms.Add(Matrix.Identity);
                treeTransforms.Add(Matrix.CreateRotationY(1.57f));
                treeTints.Add(Color.White);
                treeTints.Add(Color.White);

                foreach (var member in typeof(ContentPaths.Entities.Plants).GetFields())
                {
                    if (member.IsStatic && member.FieldType == typeof(String))
                    {
                        var texture = TextureManager.GetTexture(member.GetValue(null).ToString());

                        // lol, worst hack. This should be data driven.
                        if (member.Name != "candycane")
                        {
                            BatchBillboardPrimitives[member.Name] = new BatchBillboardPrimitive(graphics, texture, texture.Width, texture.Height,
                                                                                                new Point(0, 0), texture.Width / 32.0f, texture.Height / 32.0f, false,
                                                                                                treeTransforms, treeTints, treeTints);
                        }
                        else
                        {
                            BatchBillboardPrimitives[member.Name] = new BatchBillboardPrimitive(graphics, texture, texture.Width, texture.Height,
                                                                                                new Point(0, 0), texture.Width / 32.0f, texture.Height / 32.0f, false,
                                                                                                new List <Matrix>()
                            {
                                treeTransforms[0]
                            }, new List <Color>()
                            {
                                treeTints[0]
                            }, new List <Color>()
                            {
                                treeTints[0]
                            });
                        }
                    }
                }
            }
        }
Exemplo n.º 2
0
        public void Initialize(GraphicsDevice graphics, ContentManager content)
        {
            if (!m_initialized)
            {
                Texture2D spriteSheet = TextureManager.GetTexture(ContentPaths.Entities.Furniture.bedtex);
                OldBoxPrimitive.BoxTextureCoords boxCoords = new OldBoxPrimitive.BoxTextureCoords(spriteSheet.Width, spriteSheet.Height,
                                                                                                  new OldBoxPrimitive.FaceData(new Rectangle(0, 24, 24, 16), true),
                                                                                                  new OldBoxPrimitive.FaceData(new Rectangle(72, 24, 24, 16), true),
                                                                                                  new OldBoxPrimitive.FaceData(new Rectangle(24, 0, 48, 24), false),
                                                                                                  new OldBoxPrimitive.FaceData(new Rectangle(0, 0, 1, 1), true),
                                                                                                  new OldBoxPrimitive.FaceData(new Rectangle(24, 24, 48, 16), true),
                                                                                                  new OldBoxPrimitive.FaceData(new Rectangle(24, 40, 48, 16), true));
                BoxPrimitives["bed"] = new OldBoxPrimitive(graphics, 0.8f, 0.5f, 1.8f, boxCoords);

                Texture2D bookSheet = TextureManager.GetTexture(ContentPaths.Entities.Furniture.bookshelf);
                OldBoxPrimitive.BoxTextureCoords bookshelfTexture = new OldBoxPrimitive.BoxTextureCoords(bookSheet.Width, bookSheet.Height,
                                                                                                         new OldBoxPrimitive.FaceData(new Rectangle(0, 20, 20, 32), true),
                                                                                                         new OldBoxPrimitive.FaceData(new Rectangle(28, 20, 20, 32), true),
                                                                                                         new OldBoxPrimitive.FaceData(new Rectangle(20, 0, 8, 20), false),
                                                                                                         new OldBoxPrimitive.FaceData(new Rectangle(0, 0, 1, 1), true),
                                                                                                         new OldBoxPrimitive.FaceData(new Rectangle(20, 20, 8, 32), true),
                                                                                                         new OldBoxPrimitive.FaceData(new Rectangle(20, 52, 8, 32), true));
                BoxPrimitives["bookshelf"] = new OldBoxPrimitive(graphics, 20.0f / 32.0f, 32.0f / 32.0f, 8.0f / 32.0f, bookshelfTexture);

                m_initialized = false;


                Texture2D sheetTiles = TextureManager.GetTexture(ContentPaths.Terrain.terrain_tiles);
                OldBoxPrimitive.BoxTextureCoords crateCoords = new OldBoxPrimitive.BoxTextureCoords(sheetTiles.Width, sheetTiles.Height, 32, 32,
                                                                                                    new Point(7, 0),
                                                                                                    new Point(7, 0),
                                                                                                    new Point(8, 0),
                                                                                                    new Point(7, 0),
                                                                                                    new Point(7, 0),
                                                                                                    new Point(7, 0));
                BoxPrimitives["crate"] = new OldBoxPrimitive(graphics, 0.9f, 0.9f, 0.9f, crateCoords);
                m_initialized          = false;

                Texture2D     treeSheet      = TextureManager.GetTexture(ContentPaths.Entities.Plants.pine);
                Texture2D     snowpineSheet  = TextureManager.GetTexture(ContentPaths.Entities.Plants.snowpine);
                Texture2D     palmSheet      = TextureManager.GetTexture(ContentPaths.Entities.Plants.palm);
                List <Matrix> treeTransforms = new List <Matrix>();
                List <Color>  treeTints      = new List <Color>();
                treeTransforms.Add(Matrix.Identity);
                treeTransforms.Add(Matrix.CreateRotationY(1.57f));
                treeTints.Add(Color.White);
                treeTints.Add(Color.White);

                BatchBillboardPrimitives["pine"]     = new BatchBillboardPrimitive(graphics, treeSheet, treeSheet.Width, treeSheet.Height, new Point(0, 0), treeSheet.Width / 32.0f, treeSheet.Height / 32.0f, false, treeTransforms, treeTints);
                BatchBillboardPrimitives["snowpine"] = new BatchBillboardPrimitive(graphics, snowpineSheet, snowpineSheet.Width, snowpineSheet.Height, new Point(0, 0), snowpineSheet.Width / 32.0f, snowpineSheet.Height / 32.0f, false, treeTransforms, treeTints);
                BatchBillboardPrimitives["palm"]     = new BatchBillboardPrimitive(graphics, palmSheet, palmSheet.Width, palmSheet.Height, new Point(0, 0), palmSheet.Width / 32.0f, palmSheet.Height / 32.0f, false, treeTransforms, treeTints);



                List <string> motes = new List <string>
                {
                    "berrybush",
                    "frostgrass",
                    "flower",
                    "grass",
                    "deadbush",
                    "mushroom",
                    "vine",
                    "gnarled"
                };

                foreach (string mote in motes)
                {
                    CreateIntersecting(mote, ProgramData.CreatePath("Entities", "Plants", mote), graphics, content);
                }
            }
        }
Exemplo n.º 3
0
 public Box(ComponentManager manager, string name, GameComponent parent, Matrix localTransform, Vector3 boundingBoxExtents, Vector3 boundingBoxPos, OldBoxPrimitive primitive, Texture2D tex) :
     base(name, parent, localTransform, boundingBoxExtents, boundingBoxPos, false)
 {
     Primitive = primitive;
     Texture   = tex;
 }
Exemplo n.º 4
0
        public void Initialize(GraphicsDevice graphics, ContentManager content)
        {
            if(!m_initialized)
            {
                Texture2D spriteSheet = TextureManager.GetTexture(ContentPaths.Entities.Furniture.bedtex);
                OldBoxPrimitive.BoxTextureCoords boxCoords = new OldBoxPrimitive.BoxTextureCoords(spriteSheet.Width, spriteSheet.Height,
                    new OldBoxPrimitive.FaceData(new Rectangle(0, 24, 24, 16), true),
                    new OldBoxPrimitive.FaceData(new Rectangle(72, 24, 24, 16), true),
                    new OldBoxPrimitive.FaceData(new Rectangle(24, 0, 48, 24), false),
                    new OldBoxPrimitive.FaceData(new Rectangle(0, 0, 1, 1), true),
                    new OldBoxPrimitive.FaceData(new Rectangle(24, 24, 48, 16), true),
                    new OldBoxPrimitive.FaceData(new Rectangle(24, 40, 48, 16), true));
                BoxPrimitives["bed"] = new OldBoxPrimitive(graphics, 0.8f, 0.5f, 1.8f, boxCoords);

                Texture2D bookSheet = TextureManager.GetTexture(ContentPaths.Entities.Furniture.bookshelf);
                OldBoxPrimitive.BoxTextureCoords bookshelfTexture = new OldBoxPrimitive.BoxTextureCoords(bookSheet.Width, bookSheet.Height,
                        new OldBoxPrimitive.FaceData(new Rectangle(0, 20, 20, 32), true),
                        new OldBoxPrimitive.FaceData(new Rectangle(28, 20, 20, 32), true),
                        new OldBoxPrimitive.FaceData(new Rectangle(20, 0, 8, 20), false),
                        new OldBoxPrimitive.FaceData(new Rectangle(0, 0, 1, 1), true),
                        new OldBoxPrimitive.FaceData(new Rectangle(20, 20, 8, 32), true),
                        new OldBoxPrimitive.FaceData(new Rectangle(20, 52, 8, 32), true));
                BoxPrimitives["bookshelf"] = new OldBoxPrimitive(graphics, 20.0f / 32.0f, 32.0f / 32.0f, 8.0f / 32.0f, bookshelfTexture);

                m_initialized = false;

                Texture2D sheetTiles = TextureManager.GetTexture(ContentPaths.Terrain.terrain_tiles);
                OldBoxPrimitive.BoxTextureCoords crateCoords = new OldBoxPrimitive.BoxTextureCoords(sheetTiles.Width, sheetTiles.Height, 32, 32,
                    new Point(7, 0),
                    new Point(7, 0),
                    new Point(8, 0),
                    new Point(7, 0),
                    new Point(7, 0),
                    new Point(7, 0));
                BoxPrimitives["crate"] = new OldBoxPrimitive(graphics, 0.9f, 0.9f, 0.9f, crateCoords);
                m_initialized = false;

                Texture2D treeSheet = TextureManager.GetTexture(ContentPaths.Entities.Plants.pine);
                Texture2D snowpineSheet = TextureManager.GetTexture(ContentPaths.Entities.Plants.snowpine);
                Texture2D palmSheet = TextureManager.GetTexture(ContentPaths.Entities.Plants.palm);
                List<Matrix> treeTransforms = new List<Matrix>();
                List<Color> treeTints = new List<Color>();
                treeTransforms.Add(Matrix.Identity);
                treeTransforms.Add(Matrix.CreateRotationY(1.57f));
                treeTints.Add(Color.White);
                treeTints.Add(Color.White);

                BatchBillboardPrimitives["pine"] = new BatchBillboardPrimitive(graphics, treeSheet, treeSheet.Width, treeSheet.Height, new Point(0, 0), treeSheet.Width / 32.0f, treeSheet.Height / 32.0f, false, treeTransforms, treeTints);
                BatchBillboardPrimitives["snowpine"] = new BatchBillboardPrimitive(graphics, snowpineSheet, snowpineSheet.Width, snowpineSheet.Height, new Point(0, 0), snowpineSheet.Width / 32.0f, snowpineSheet.Height / 32.0f, false, treeTransforms, treeTints);
                BatchBillboardPrimitives["palm"] = new BatchBillboardPrimitive(graphics, palmSheet, palmSheet.Width, palmSheet.Height, new Point(0, 0), palmSheet.Width / 32.0f, palmSheet.Height / 32.0f, false, treeTransforms, treeTints);

                List<string> motes = new List<string>
                {
                    "berrybush",
                    "frostgrass",
                    "flower",
                    "grass",
                    "deadbush",
                    "mushroom",
                    "vine",
                    "gnarled"
                };

                foreach(string mote in motes)
                {
                    CreateIntersecting(mote, ProgramData.CreatePath("Entities", "Plants", mote), graphics, content);
                }

            }
        }
Exemplo n.º 5
0
 public Box(ComponentManager manager, string name, GameComponent parent, Matrix localTransform, Vector3 boundingBoxExtents, Vector3 boundingBoxPos, OldBoxPrimitive primitive, Texture2D tex)
     : base(name, parent, localTransform, boundingBoxExtents, boundingBoxPos, false)
 {
     Primitive = primitive;
     Texture = tex;
 }