mirror of
https://gitgud.io/AbstractConcept/rimworld-animation-studio.git
synced 2024-08-15 00:43:27 +00:00
Improved adding and removal of anim events
This commit is contained in:
parent
f0d46df3d6
commit
8523abf957
276 changed files with 1401 additions and 5422 deletions
35
Assets/Scripts/Utilities/PawnUtility.cs
Normal file
35
Assets/Scripts/Utilities/PawnUtility.cs
Normal file
|
@ -0,0 +1,35 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
|
||||
namespace RimWorldAnimationStudio
|
||||
{
|
||||
public static class PawnUtility
|
||||
{
|
||||
public static Vector3 BaseHeadOffsetAt(string bodyType, int rotation)
|
||||
{
|
||||
Vector2 headOffset = Vector3.zero;
|
||||
|
||||
switch (bodyType)
|
||||
{
|
||||
case "Male": headOffset = new Vector2(0.04f, 0.34f); break;
|
||||
case "Female": headOffset = new Vector2(0.10f, 0.34f); break;
|
||||
case "Thin": headOffset = new Vector2(0.09f, 0.34f); break;
|
||||
case "Hulk": headOffset = new Vector2(0.10f, 0.34f); break;
|
||||
case "Fat": headOffset = new Vector2(0.09f, 0.34f); break;
|
||||
}
|
||||
|
||||
switch (rotation)
|
||||
{
|
||||
case 0: return new Vector3(0f, 0f, headOffset.y);
|
||||
case 1: return new Vector3(headOffset.x, 0f, headOffset.y);
|
||||
case 2: return new Vector3(0f, 0f, headOffset.y);
|
||||
case 3: return new Vector3(-headOffset.x, 0f, headOffset.y);
|
||||
default: return Vector3.zero;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
11
Assets/Scripts/Utilities/PawnUtility.cs.meta
Normal file
11
Assets/Scripts/Utilities/PawnUtility.cs.meta
Normal file
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: d7c648d5b6a74be448da40e4ed79c8c5
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
37
Assets/Scripts/Utilities/XmlUtility.cs
Normal file
37
Assets/Scripts/Utilities/XmlUtility.cs
Normal file
|
@ -0,0 +1,37 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.IO;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace RimWorldAnimationStudio
|
||||
{
|
||||
public static class XmlUtility
|
||||
{
|
||||
public static T ReadXML<T>(string path)
|
||||
{
|
||||
using (StreamReader stringReader = new StreamReader(path))
|
||||
{
|
||||
XmlSerializer serializer = new XmlSerializer(typeof(T));
|
||||
|
||||
return (T)serializer.Deserialize(stringReader);
|
||||
}
|
||||
}
|
||||
|
||||
public static void WriteXML(Defs defs, string path)
|
||||
{
|
||||
if (defs == null || path == null || path == "")
|
||||
{ return; }
|
||||
|
||||
XmlSerializer writer = new XmlSerializer(typeof(Defs));
|
||||
XmlSerializerNamespaces nameSpaces = new XmlSerializerNamespaces();
|
||||
nameSpaces.Add("", "");
|
||||
|
||||
FileStream file = File.Create(path);
|
||||
writer.Serialize(file, defs, nameSpaces);
|
||||
file.Close();
|
||||
}
|
||||
}
|
||||
}
|
11
Assets/Scripts/Utilities/XmlUtility.cs.meta
Normal file
11
Assets/Scripts/Utilities/XmlUtility.cs.meta
Normal file
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 98d85a0061a130d47863c6a7b14df10f
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Loading…
Add table
Add a link
Reference in a new issue