BITFALL/Assets/Artists/Scripts/HotFix/FPVScaleFix.cs

33 lines
716 B
C#

using System;
using System.Collections;
using System.Collections.Generic;
using BITKit;
using UnityEngine;
namespace BITFALL.HotFix
{
public class FPVScaleFix : MonoBehaviour
{
[SerializeField] private Transform fpvScale;
[SerializeField] private Transform center;
[SerializeField] private Optional<Transform> viewFix;
[SerializeField] private Optional<Vector3> offset;
private void Update()
{
fpvScale.localScale = Vector3.zero;
}
private void LateUpdate()
{
fpvScale.localScale = Vector3.zero;
if (viewFix.Allow)
{
fpvScale.position = viewFix.Value.position - center.forward +
(offset.Allow ? center.rotation * offset.Value : default);
}
}
}
}