private void Parse(XmlElement element, SpriterAnimation animation, MainlineKey parentKey) { Referenced = GetTimelineKey(element, animation); int parentId = element.GetInt("parent", -1); if (parentId >= 0) { Parent = parentKey.GetBoneRef(parentId); } }
private void MakePrefab(MainlineKey mainKey, GameObject root, string spriteFolder) { var rootInfo = mainKey.GetChildren(null).Select(child => new RefParentInfo { Ref = child, Root = root }); Stack<RefParentInfo> toProcess = new Stack<RefParentInfo>(rootInfo); while(toProcess.Count > 0) { var next = toProcess.Pop(); var go = MakePrefab(next.Ref, next.Root, spriteFolder); foreach(var child in mainKey.GetChildren(next.Ref)) { toProcess.Push(new RefParentInfo{Ref = child, Root = go}); } } }
public ObjectRef(XmlElement element, SpriterAnimation animation, MainlineKey parentKey) : base(element, animation, parentKey) { }
public Ref(XmlElement element, SpriterAnimation animation, MainlineKey parentKey) : base(element) { MainlineKey = parentKey; Parse(element, animation, parentKey); }
private void Parse(XmlElement element, SpriterAnimation animation, MainlineKey parentKey) { Referenced = GetTimelineKey(element, animation); int parentId = element.GetInt("parent", -1); if(parentId >= 0) { Parent = parentKey.GetBoneRef(parentId); } }
public Ref(XmlElement element, Animation animation, MainlineKey parentKey) : base(element) { Parse(element, animation, parentKey); }
private void SetGameObjectForKey(GameObject root, AnimationClip animClip, MainlineKey mainlineKey) { //Could do this recursively - this is easier Stack<Ref> toProcess = new Stack<Ref>(mainlineKey.GetChildren(null)); while(toProcess.Count > 0) { var next = toProcess.Pop(); SetGameObjectForRef(root, next); SetSpriteEvent(animClip, mainlineKey.Time, next); var children = mainlineKey.GetChildren(next); foreach (var child in children) toProcess.Push(child); } }
private HashSet<string> SetGameObjectForKey(GameObject root, AnimationClip animClip, MainlineKey mainlineKey, float time = -1) { HashSet<string> paths = new HashSet<string>(); //Could do this recursively - this is easier Stack<Ref> toProcess = new Stack<Ref>(mainlineKey.GetChildren(null)); while (toProcess.Count > 0) { var next = toProcess.Pop(); paths.Add(next.RelativePath); SetGameObjectForRef(root, next, time); SetSpriteEvent(animClip, time, next); var children = mainlineKey.GetChildren(next); foreach (var child in children) toProcess.Push(child); } return paths; }
public BoneRef(XmlElement element, Animation animation, MainlineKey parentKey) : base(element, animation, parentKey) { }