// // Contracts // /// <summary> /// Implements what the animation will actually perform /// </summary> protected override void Animate() { // Change the SpriteEntity's Image AnimationUnitFrame currUnit = this.currentUnit as AnimationUnitFrame; Debug.Assert(currUnit != null); this.spriteTarget.SetMapping(currUnit.ImageReference); }
/// <summary> /// Attaches an Image to the frame animation /// </summary> /// <param name="newImage"></param> /// <returns></returns> public AnimationUnitFrame Attach(Image newImage) { AnimationUnitFrame newUnit = this.BaseAttach(0u) as AnimationUnitFrame; newUnit.SetImage(newImage); this.PointToStartingAnimationUnit(); return(newUnit); }
// Prefills the pool with the given number of elements protected override void FillReserve(int fillSize) { for (int i = fillSize; i > 0; i--) { AnimationUnitFrame newNode = new AnimationUnitFrame(); this.reservedList.PushFront(newNode); } }
/// <summary> /// Attaches an Image to the frame animation /// </summary> /// <param name="imageName"></param> /// <returns></returns> public AnimationUnitFrame Attach(Image.Name imageName) { Image newImage = ImageManager.Self.Find(imageName); AnimationUnitFrame newUnit = this.BaseAttach(0u) as AnimationUnitFrame; newUnit.SetImage(newImage); this.PointToStartingAnimationUnit(); return(newUnit); }
/// <summary> /// Removes an Image from the frame animation /// </summary> /// <param name="oldName"></param> /// <returns></returns> public bool Detach(Image.Name oldName) { AnimationUnitFrame oldUnit = this.BaseDetach(oldName, 0u) as AnimationUnitFrame; if (oldUnit == null) { return(false); } oldUnit.Reset(); return(true); }