Example #1
0
 public override void OnAncestryChanged()
 {
     base.OnAncestryChanged();
     this.layer = this.GetAncestor<Layer>();
 }
Example #2
0
        public override void OnAdd(Component parent)
        {
            #if DEBUG
            if (!(parent is Layer))
            {
                throw new Exception("Please add the TiledIntegrater to a Layer.");
            }
            #endif
            this.layer = parent as Layer;
            float w = this.layer.Bounds.X;
            float h = this.layer.Bounds.Y;

            this.tilesX = (int)Math.Ceiling(w / this.tileSize);
            this.tilesY = (int)Math.Ceiling(h / this.tileSize);
            this.tileCount = this.tilesX * this.tilesY;

            this.tiles = new Tile[this.tileCount];
            for (int i = 0; i < this.tileCount; i++)
                this.tiles[i] = new Tile(i % this.tilesX, i / this.tilesX);

            this.positions = new Dictionary<Entity, TilePosition>();

            base.OnAdd(parent);
        }
Example #3
0
 public RestrictCamera(Layer layer, bool horizontal, bool vertical)
 {
     this.layer = layer;
     this.horizontal = horizontal;
     this.vertical = vertical;
 }
Example #4
0
 public RestrictCamera(Layer layer)
     : this(layer, true, true)
 {
 }
Example #5
0
 public override void OnAdd(Component parent)
 {
     base.OnAdd(parent);
     this.layer = parent as Layer;
     this.Zoom = 1;
 }