示例#1
0
 public override void OnAncestryChanged()
 {
     base.OnAncestryChanged();
     this.layer = this.GetAncestor<Layer>();
 }
示例#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);
        }
示例#3
0
 public RestrictCamera(Layer layer, bool horizontal, bool vertical)
 {
     this.layer = layer;
     this.horizontal = horizontal;
     this.vertical = vertical;
 }
示例#4
0
 public RestrictCamera(Layer layer)
     : this(layer, true, true)
 {
 }
示例#5
0
文件: Camera.cs 项目: HuntiXz/phantom
 public override void OnAdd(Component parent)
 {
     base.OnAdd(parent);
     this.layer = parent as Layer;
     this.Zoom = 1;
 }