/// <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(); }
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(); }
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 AnimatorEventArgs(Tile _tile, Animator _animator) { tile = _tile; animator = _animator; }