rimworld-animation-studio/Assets/Scripts/AnimationComponents/Actor.cs

59 lines
2.6 KiB
C#
Raw Normal View History

2022-09-13 05:36:34 +00:00
using System.Collections.Generic;
using System.Xml;
using System.Xml.Serialization;
using UnityEngine;
namespace RimWorldAnimationStudio
{
public class Actor
{
[XmlArray("defNames"), XmlArrayItem("li")] public List<string> defNames = new List<string>();
[XmlArray("bodyDefTypes"), XmlArrayItem("li")] public List<string> bodyDefTypes = new List<string>();
[XmlArray("requiredGender"), XmlArrayItem("li")] public List<string> requiredGender = new List<string>();
[XmlArray("requiredGenitals"), XmlArrayItem("li")] public List<string> requiredGenitals = new List<string>();
[XmlArray("raceOffsets"), XmlArrayItem("li")] public List<AlienRaceOffset> raceOffsets = new List<AlienRaceOffset>();
[XmlArray("blacklistedRaces"), XmlArrayItem("li")] public List<string> blacklistedRaces = new List<string>();
[XmlArray("tags"), XmlArrayItem("li")] public List<string> tags;
2022-09-13 05:36:34 +00:00
public string gender;
public BodyTypeOffset bodyTypeOffset = new BodyTypeOffset();
public bool initiator = false;
public bool? controlGenitalAngle;
public bool? isFucking;
public bool? isFucked;
public bool ShouldSerializedefNames() { return defNames.NotNullOrEmpty(); }
public bool ShouldSerializebodyDefTypes() { return bodyDefTypes.NotNullOrEmpty(); }
public bool ShouldSerializerequiredGender() { return requiredGender.NotNullOrEmpty(); }
public bool ShouldSerializerequiredGenitals() { return requiredGenitals.NotNullOrEmpty(); }
public bool ShouldSerializeraceOffsets() { return raceOffsets.NotNullOrEmpty(); }
public bool ShouldSerializeblacklistedRaces() { return blacklistedRaces.NotNullOrEmpty(); }
public bool ShouldSerializetags() { return tags.NotNullOrEmpty(); }
public bool ShouldSerializecontrolGenitalAngle() { return controlGenitalAngle != null; }
public bool ShouldSerializeisFucking() { return isFucking != null; }
public bool ShouldSerializeisFucked() { return isFucked != null; }
public bool MakeNew()
{
if (Workspace.animationDef == null)
{ Debug.LogWarning("Cannot make new actor - there is no AnimationDef"); return false; }
Workspace.animationDef.actors.Add(this);
foreach (AnimationStage stage in Workspace.animationDef.animationStages)
{
PawnAnimationClip clip = new PawnAnimationClip();
if (clip.MakeNew())
{
stage.animationClips.Add(clip);
stage.Initialize();
}
}
return true;
}
2022-09-13 05:36:34 +00:00
}
}