示例#1
0
        public MovingBlock(QuickGameScene scene, AdjacentTileGroup <MovingBlockPiece> tiles, AdjacentTileGroup <PathPoint> path)
        {
            Scene         = scene;
            motionManager = new MotionManager(this);

            SpriteGrid = new SpriteGrid
            {
                Texture = Textures.MovingBlockTexture
            };

            Position = tiles.GetBoundingBox();

            float tilesX = (float)Position.Width / 16f; //todo
            float tilesY = (float)Position.Height / 16f;

            SpriteGrid.Cells = new ArrayGrid <int>(new Vector2(tilesX, tilesY));
            foreach (var pt in SpriteGrid.Cells.Points)
            {
                //todo, nonstandard shapes
                SpriteGrid.Cells.Set(pt, 0);
            }

            new PathMoverBehavior <MovingBlock>(this, path);

            Scene.SolidLayer.AddObject(this);
        }