public void Initialize() { HealthIconAnimation = SpriteAnimationFactory.CreateAnimationInstance(SpriteAnimationType.OwlHealthIcon); MoneyBagIconAnimation = SpriteAnimationFactory.CreateAnimationInstance(SpriteAnimationType.Bonbon_Gold); CrossAnimation = SpriteAnimationFactory.CreateAnimationInstance(SpriteAnimationType.Cross); DigitAnimations = new SpriteAnimationInstance[10]; for (int digit = 0; digit < DigitAnimations.Length; digit++) { SpriteAnimationType animType = SpriteAnimationType.Digit0 + digit; DigitAnimations[digit] = SpriteAnimationFactory.CreateAnimationInstance(animType); } KeyRingAnchor.AttachTo(HealthIconAnchor); KeyRingAnchor.Position.Y += 64; KeyAnimations = new SpriteAnimationInstance[(int)KeyType.COUNT]; for (int keyIndex = 0; keyIndex < KeyAnimations.Length; keyIndex++) { SpriteAnimationType animType = SpriteAnimationType.Key_Gold + keyIndex; KeyAnimations[keyIndex] = SpriteAnimationFactory.CreateAnimationInstance(animType); } }
/// <summary> /// Returns the SpatialData instance representing the offset. /// </summary> public static SpatialData AttachWithOffsetTo(this ISpatial self, ISpatial newParent, Vector2 positionOffset, Angle rotationOffset) { SpatialData result = null; if (newParent != self) { result = new SpatialData() { Position = positionOffset, Rotation = rotationOffset }; result.AttachTo(newParent); self.AttachTo(result); } return(result); }