mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
Animated nomai recorders (#263)
This commit is contained in:
commit
ec2845b4cd
@ -408,35 +408,23 @@ namespace NewHorizons.Builder.Props
|
|||||||
case PropModule.NomaiTextInfo.NomaiTextType.PreCrashRecorder:
|
case PropModule.NomaiTextInfo.NomaiTextType.PreCrashRecorder:
|
||||||
case PropModule.NomaiTextInfo.NomaiTextType.Recorder:
|
case PropModule.NomaiTextInfo.NomaiTextType.Recorder:
|
||||||
{
|
{
|
||||||
var recorderObject = (info.type == PropModule.NomaiTextInfo.NomaiTextType.PreCrashRecorder ? _preCrashRecorderPrefab : _recorderPrefab).InstantiateInactive();
|
var prefab = (info.type == PropModule.NomaiTextInfo.NomaiTextType.PreCrashRecorder ? _preCrashRecorderPrefab : _recorderPrefab);
|
||||||
|
var detailInfo = new PropModule.DetailInfo {
|
||||||
|
parentPath = info.parentPath,
|
||||||
|
rotation = info.rotation,
|
||||||
|
position = info.position
|
||||||
|
};
|
||||||
|
var recorderObject = DetailBuilder.MakeDetail(planetGO, sector, prefab, detailInfo);
|
||||||
|
recorderObject.SetActive(false);
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(info.rename))
|
if (!string.IsNullOrEmpty(info.rename))
|
||||||
{
|
{
|
||||||
recorderObject.name = info.rename;
|
recorderObject.name = info.rename;
|
||||||
}
|
}
|
||||||
|
|
||||||
recorderObject.transform.parent = sector?.transform ?? planetGO.transform;
|
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(info.parentPath))
|
|
||||||
{
|
|
||||||
var newParent = planetGO.transform.Find(info.parentPath);
|
|
||||||
if (newParent != null)
|
|
||||||
{
|
|
||||||
recorderObject.transform.parent = newParent;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Logger.LogWarning($"Cannot find parent object at path: {planetGO.name}/{info.parentPath}");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
recorderObject.transform.position = planetGO.transform.TransformPoint(info?.position ?? Vector3.zero);
|
recorderObject.transform.position = planetGO.transform.TransformPoint(info?.position ?? Vector3.zero);
|
||||||
|
|
||||||
if (info.rotation != null)
|
if (info.rotation == null)
|
||||||
{
|
|
||||||
recorderObject.transform.rotation = planetGO.transform.TransformRotation(Quaternion.Euler(info.rotation));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
var up = recorderObject.transform.position - planetGO.transform.position;
|
var up = recorderObject.transform.position - planetGO.transform.position;
|
||||||
recorderObject.transform.rotation = Quaternion.FromToRotation(Vector3.up, up) * recorderObject.transform.rotation;
|
recorderObject.transform.rotation = Quaternion.FromToRotation(Vector3.up, up) * recorderObject.transform.rotation;
|
||||||
@ -451,9 +439,6 @@ namespace NewHorizons.Builder.Props
|
|||||||
nomaiText._nomaiTextAsset.name = Path.GetFileNameWithoutExtension(info.xmlFile);
|
nomaiText._nomaiTextAsset.name = Path.GetFileNameWithoutExtension(info.xmlFile);
|
||||||
AddTranslation(xmlPath);
|
AddTranslation(xmlPath);
|
||||||
|
|
||||||
// Make sure the recorder model is loaded
|
|
||||||
StreamingHandler.SetUpStreaming(recorderObject, sector);
|
|
||||||
|
|
||||||
recorderObject.SetActive(true);
|
recorderObject.SetActive(true);
|
||||||
|
|
||||||
recorderObject.transform.Find("InteractSphere").gameObject.GetComponent<SphereShape>().enabled = true;
|
recorderObject.transform.Find("InteractSphere").gameObject.GetComponent<SphereShape>().enabled = true;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user