1
This commit is contained in:
@@ -16,11 +16,14 @@ namespace BITKit
|
||||
[SerializeField] private Vector3 positionWeight = Vector3.one;
|
||||
|
||||
[SerializeReference,SubclassSelector] private IReference autoReference;
|
||||
[SerializeReference,SubclassSelector] private IReference nameReference;
|
||||
//[SerializeField] private Vector3 rotationAdditive = Vector3.one;
|
||||
private Transform Transform;
|
||||
|
||||
private string nameCache;
|
||||
private void Start()
|
||||
{
|
||||
nameCache = nameReference is not null?nameReference.Value:gameObject.name;
|
||||
Transform = transform;
|
||||
var components =
|
||||
GetComponentsInParent<LocationAdditive>(true)
|
||||
@@ -39,7 +42,6 @@ namespace BITKit
|
||||
reportBuilder.AppendLine(x.autoReference is not null ? $"{x.autoReference.Value}@{x.transform.name}" : x.name);
|
||||
}
|
||||
BIT4Log.Log<LocationAdditiveElement>($"找不到对应的LocationAdditive:{autoReference.Value} \n{reportBuilder}");
|
||||
throw;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -58,11 +60,12 @@ namespace BITKit
|
||||
|
||||
private void Tick()
|
||||
{
|
||||
if (!locationAdditive) return;
|
||||
var localPosition = Transform.localPosition;
|
||||
|
||||
locationAdditive.AddPosition(Vector3.Scale(localPosition, positionWeight));
|
||||
locationAdditive.AddPosition(Vector3.Scale(localPosition, positionWeight), nameReference?.Value);
|
||||
//locationAdditive.AddRotation(Transform.localRotation * Quaternion.Euler(rotationAdditive));
|
||||
locationAdditive.AddRotation(Transform.localRotation);
|
||||
locationAdditive.AddRotation(Transform.localRotation, nameCache);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user