2023-11-21 18:05:18 +08:00
|
|
|
using System;
|
|
|
|
using System.Collections;
|
|
|
|
using System.Collections.Generic;
|
2024-04-19 00:40:34 +08:00
|
|
|
using BITKit;
|
2023-11-21 18:05:18 +08:00
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
namespace BITFALL.HotFix
|
|
|
|
{
|
|
|
|
public class FPVScaleFix : MonoBehaviour
|
|
|
|
{
|
2023-12-16 23:30:08 +08:00
|
|
|
[SerializeField] private Transform fpvScale;
|
2024-04-19 00:40:34 +08:00
|
|
|
[SerializeField] private Transform center;
|
|
|
|
[SerializeField] private Optional<Transform> viewFix;
|
2024-04-22 01:21:28 +08:00
|
|
|
[SerializeField] private Optional<Vector3> offset;
|
2023-12-30 17:37:48 +08:00
|
|
|
|
|
|
|
private void Update()
|
|
|
|
{
|
|
|
|
fpvScale.localScale = Vector3.zero;
|
|
|
|
}
|
|
|
|
|
2023-11-21 18:05:18 +08:00
|
|
|
private void LateUpdate()
|
|
|
|
{
|
2023-12-16 23:30:08 +08:00
|
|
|
fpvScale.localScale = Vector3.zero;
|
2024-04-19 00:40:34 +08:00
|
|
|
if (viewFix.Allow)
|
|
|
|
{
|
2024-04-22 01:21:28 +08:00
|
|
|
fpvScale.position = viewFix.Value.position - center.forward +
|
|
|
|
(offset.Allow ? center.rotation * offset.Value : default);
|
2024-04-19 00:40:34 +08:00
|
|
|
}
|
2023-11-21 18:05:18 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|