Exemple #1
0
        /// <summary>
        /// Private constructor used when calling the Clone() method on a Sprite.
        /// </summary>
        private Sprite(Sprite sprite)
        {
            id = Guid.NewGuid().ToString();
            animator = new Animator(this);
            movement = new Movement(this);
            Sprites._spriteList.Add(this);

            parentGrid = sprite.parentGrid;
            frame = sprite.frame;
            DetectCollision = sprite.collisionDetection;
            horizAlign = sprite.horizAlign;
            vertAlign = sprite.vertAlign;
            nudgeX = sprite.nudgeX;
            nudgeY = sprite.nudgeY;
            renderSize = sprite.renderSize;
            ZOrder = sprite.zOrder;
            visible = sprite.visible;
            gridCoordinates = sprite.gridCoordinates;
            AdjustCollisionArea = sprite.AdjustCollisionArea;

            if (parentGrid != null)
                parentGrid.RefreshQueue.AddPixelRangeToRefreshQueue(this.DrawLocation, true);

            Sprites.SubscribeToSpriteEvents(this);

            CreateChildSprites();
        }
Exemple #2
0
        protected internal Sprite(GridPointMatrix matrix, Frame frame)
        {
            id = Guid.NewGuid().ToString();
            parentGrid = matrix;
            animator = new Animator(this);
            movement = new Movement(this);
            pauseAnimation = false;
            pauseMovement = false;
            horizAlign = HorizontalAlignment.Center;
            vertAlign = VerticalAlignment.Bottom;
            nudgeX = 0;
            nudgeY = 0;
            CurrentFrame = frame;

            if ((Sprites.SizeNewSpritesToParentGrid) && (parentGrid != null))
                renderSize = new Size(parentGrid.GridPointWidth, parentGrid.GridPointHeight);
            else
                renderSize = CurrentFrame.Tilesheet.TileSize;

            zOrder = 1;

            if (parentGrid != null)
                parentGrid.RefreshQueue.AddPixelRangeToRefreshQueue(this.DrawLocation, true);

            Sprites._spriteList.Add(this);
            CreateChildSprites();
        }
Exemple #3
0
        private void OnDeserialized(StreamingContext context)
        {
            animator = new Animator(this);
            movement = new Movement(this);
            pauseAnimation = false;
            pauseMovement = false;

            if (parentGrid != null)
                parentGrid.RefreshQueue.AddPixelRangeToRefreshQueue(this.DrawLocation, true);

            Sprites._spriteList.Add(this);
            Sprites.SubscribeToSpriteEvents(this);

            CreateChildSprites();
        }
 protected internal SpriteMovePointFinishedEventArgs(Sprite _sprite, Movement _movement, MovePoint _movePoint)
 {
     sprite = _sprite;
     movement = _movement;
     movePoint = _movePoint;
 }
 protected internal SpriteMovementEventArgs(Sprite _sprite, Movement _movement)
 {
     sprite = _sprite;
     movement = _movement;
 }