using System.Collections.Generic; using System.Xml; using System.Xml.Serialization; using UnityEngine; namespace RimWorldAnimationStudio { public class AnimationStage { public string stageName = "NewStage"; public int stageIndex = 0; public int playTimeTicks = 0; public int playTimeTicksQuick = -1; public bool isLooping = false; [XmlArray("animationClips"), XmlArrayItem("li")] public List animationClips = new List(); [XmlIgnore] public int stageWindowSize = -1; public void Initialize() { foreach (AnimationClip clip in animationClips) { clip.BuildSimpleCurves(); //select playTimeTicks as longest playtime of all the animations if (clip.duration > playTimeTicks) { playTimeTicks = clip.duration; } } } public bool MakeNew() { if (Workspace.animationDef == null) { Debug.LogWarning("Cannot make new animation stage - there is no AnimationDef"); return false; } foreach(Actor actor in Workspace.animationDef.actors) { PawnAnimationClip clip = new PawnAnimationClip(); if (clip.MakeNew()) { animationClips.Add(clip); } } Initialize(); Workspace.animationDef.animationStages.Add(this); return true; } } }