更改文件架构
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using RotaryHeart.Lib.SerializableDictionary;
|
||||
namespace BITKit
|
||||
{
|
||||
public class OverrideTransform : MonoBehaviour
|
||||
{
|
||||
public List<Transform> sources = new();
|
||||
Dictionary<string, Quaternion> rotations = new();
|
||||
Dictionary<string, Vector3> positions = new();
|
||||
Quaternion currentRotation;
|
||||
Vector3 currentPosition;
|
||||
Quaternion defaultRotation;
|
||||
Vector3 defualtPosition;
|
||||
public void Set(string key, Quaternion rotation)
|
||||
{
|
||||
rotations.Insert(key, rotation);
|
||||
}
|
||||
public void Set(string key, Vector3 position)
|
||||
{
|
||||
positions.Insert(key, position);
|
||||
}
|
||||
void Start()
|
||||
{
|
||||
defaultRotation = transform.localRotation;
|
||||
defualtPosition = transform.localPosition;
|
||||
}
|
||||
void Update()
|
||||
{
|
||||
currentRotation = defaultRotation;
|
||||
currentPosition = defualtPosition;
|
||||
foreach (var x in sources)
|
||||
{
|
||||
currentRotation *= x.localRotation;
|
||||
currentPosition += x.localPosition;
|
||||
}
|
||||
foreach (var x in rotations.Values)
|
||||
{
|
||||
currentRotation *= x;
|
||||
}
|
||||
foreach (var x in positions.Values)
|
||||
{
|
||||
currentPosition += x;
|
||||
}
|
||||
}
|
||||
void LateUpdate()
|
||||
{
|
||||
transform.localPosition = currentPosition;
|
||||
transform.localRotation = currentRotation;
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fcaed8af0352fc84c881cc58485ab4b6
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Reference in New Issue
Block a user