Ejemplo n.º 1
0
 public Map(int width = 900, int height = 500)
 {
     // Init
     SizeX = width;
     SizeY = height;
     Types = new BlockType[30];
     WallTypes = new WallType[10];
     Blocks = new Block[SizeX, SizeY];
     Walls = new Wall[SizeX, SizeY];
     DroppedItems = new DroppedItemCollection();
     Fluids = new Fluid.FluidCollection();
     Entities = new EntityPackage();
     Flora = new FloraPackage();
     WallTypes[0] = new WallType(1, "Standard Wall", new Rectangle(0,0,24,24));
 }
Ejemplo n.º 2
0
        public void Update(GameTime gameTime, Control control, Camera camera, EntityPackage entities)
        {
            Sun.X = 100 * 24;
            Sun.Y = -500 * 24;

            for (int i = 0; i < entities.Entities.Count; i++)
            {
                if (entities.Entities[i] == null) { continue; }
                if (entities.Entities[i].Light == null)
                {
                    entities.Entities[i].Light = new Light2D()
                    {
                        Texture = Light,
                        Range = 100f,
                        Color = new Color(255,255,255),
                        X = camera.FromRectangle(entities.Entities[i].Area).Center.X,
                        Y = camera.FromRectangle(entities.Entities[i].Area).Center.Y,
                        Angle = MathHelper.TwoPi * 1f,
                        Intensity = 2222f,
                    };
                    krypton.Lights.Add(entities.Entities[i].Light);
                }
                else
                {
                    entities.Entities[i].Light.X = camera.FromRectangle(entities.Entities[i].Area).Center.X;
                    entities.Entities[i].Light.Y = camera.FromRectangle(entities.Entities[i].Area).Center.Y;
                }
            }
        }