/// <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(); }
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(); }