2023-06-08 14:09:50 +08:00
|
|
|
using System.Collections;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using UnityEngine;
|
2023-09-01 14:33:54 +08:00
|
|
|
// ReSharper disable InvertIf
|
2023-06-08 14:09:50 +08:00
|
|
|
namespace BITKit
|
|
|
|
{
|
2023-09-01 14:33:54 +08:00
|
|
|
public class LocationAdditive : MonoBehaviour
|
2023-06-08 14:09:50 +08:00
|
|
|
{
|
2023-09-01 14:33:54 +08:00
|
|
|
private Vector3 currentPosition;
|
|
|
|
private Vector3 currentEuler;
|
2023-06-08 14:09:50 +08:00
|
|
|
public void AddPosition(Vector3 value)
|
|
|
|
{
|
|
|
|
currentPosition += value;
|
|
|
|
}
|
|
|
|
public void AddEuler(Vector3 value)
|
|
|
|
{
|
2023-09-01 14:33:54 +08:00
|
|
|
currentEuler += value;
|
2023-06-08 14:09:50 +08:00
|
|
|
}
|
|
|
|
public void LateUpdate()
|
|
|
|
{
|
2023-09-01 14:33:54 +08:00
|
|
|
if (currentEuler.IsDefault() is false)
|
2023-06-08 14:09:50 +08:00
|
|
|
{
|
2023-09-01 14:33:54 +08:00
|
|
|
transform.localEulerAngles = currentEuler;
|
|
|
|
currentEuler = default;
|
2023-06-08 14:09:50 +08:00
|
|
|
}
|
|
|
|
if (currentPosition.IsDefault() is false)
|
|
|
|
{
|
|
|
|
transform.localPosition = currentPosition;
|
|
|
|
currentPosition = default;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|