protected override void OnCreate() { base.OnCreate(); SystemType = GetType(); AnimationMap = GetAnimationMap(); }
public override void Perform(AnimationState state, AnimationMap map) { if (framesWaited == WaitFor) { Finished = true; } else { framesWaited++; } }
public AnimationMap GetAnimationMap(string name) { AnimationMap map; if (!_animationMaps.TryGetValue(name, out map)) { map = new AnimationMap(); _animationMaps[name] = map; } return(map); }
public override void Perform(AnimationState state, AnimationMap map) { map.SetState(StateName); Finished = true; }
public abstract void Perform(AnimationState state, AnimationMap map);
/// <summary> /// Read the AAML file /// </summary> public void Read() { var AAMLFile = new XmlDocument(); try { AAMLFile.Load(AAMLFileName); } catch (IOException) { throw new IOException( String.Format( "The animation file with name '{0}' could not be loaded. The most common causes for this error are " + "either the path was misspelled, or the 'Copy to Output Directory' property of your setup file " + "is not set to 'Copy if newer'. To change this in VS, right click on your setup file in the solution " + "explorer, select properties, and change the 'Copy to Output Directory' property to 'Copy if newer'.", AAMLFileName ) ); } XmlElement root; if (AAMLFile.ChildNodes.Count < 2) { throw new AAMLSyntaxException( String.Format("No root node in AAML file '{0}'.", AAMLFileName)); } root = AAMLFile.ChildNodes[1] as XmlElement; if (root == null) { throw new AAMLSyntaxException( String.Format("No root node in AAML file '{0}'.", AAMLFileName)); } var rootChildrenElementsOnly = new List <XmlElement>( from child in root.ChildNodes.Cast <XmlNode>() where child is XmlElement select(XmlElement) child); if (rootChildrenElementsOnly.Count < 2) { throw new AAMLSyntaxException( String.Format("Invalid root node in AAML file '{0}'. Requires at least " + "two nodes for 'SpriteSheet' and 'AnimationMap'.", AAMLFileName)); } var first = rootChildrenElementsOnly[0]; var second = rootChildrenElementsOnly[1]; XmlElement spriteSheet, animationMap; if (first.Name == SPRITE_SHEET && second.Name == ANIMATION_MAP) { spriteSheet = first; animationMap = second; } else if (second.Name == SPRITE_SHEET && first.Name == ANIMATION_MAP) { spriteSheet = second; animationMap = first; } else { throw new AAMLSyntaxException( String.Format("Invalid AAML file '{0}'. Expected a SpriteSheet " + "element and an AnimationMap element.", AAMLFileName)); } var sheetReader = new SpriteSheetReader(spriteSheet); var mapReader = new AnimationMapReader(animationMap); sheetReader.Load(); mapReader.Load(); Map = new AnimationMap(mapReader.States, sheetReader.Sheet, mapReader.InitState); }
public override void Perform(AnimationState state, AnimationMap map) { state.CurrentFrame = FrameName; Finished = true; }
public override void Perform(AnimationState state, AnimationMap map) { throw new NotImplementedException(); }
public override void Perform(AnimationState state, AnimationMap map) { state.Reverse(); Finished = true; }
public override void Perform(AnimationState state, AnimationMap map) { state.JumpTo(JumpPoint); }