the initial commit to the repo.
This commit is contained in:
parent
025c032b8c
commit
1b757591b9
264 changed files with 21882 additions and 0 deletions
45
stoopid.raw/stupid.solutions.Data/GameTransitPoint.cs
Normal file
45
stoopid.raw/stupid.solutions.Data/GameTransitPoint.cs
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
using System;
|
||||
using EFT.Interactive;
|
||||
using stupid.solutions.Utils;
|
||||
using UnityEngine;
|
||||
|
||||
namespace stupid.solutions.Data;
|
||||
|
||||
internal class GameTransitPoint
|
||||
{
|
||||
private Vector3 screenPosition;
|
||||
|
||||
public TransitPoint transitPoint { get; }
|
||||
|
||||
public Vector3 ScreenPosition => screenPosition;
|
||||
|
||||
public bool IsOnScreen { get; private set; }
|
||||
|
||||
public float Distance { get; private set; }
|
||||
|
||||
public string Name { get; set; }
|
||||
|
||||
public string FormattedDistance => $"{Math.Round(Distance)}m";
|
||||
|
||||
public GameTransitPoint(TransitPoint tPoint)
|
||||
{
|
||||
if (tPoint == null)
|
||||
{
|
||||
throw new ArgumentNullException("tPoint");
|
||||
}
|
||||
transitPoint = tPoint;
|
||||
screenPosition = default(Vector3);
|
||||
Distance = 0f;
|
||||
Name = transitPoint.name ?? "";
|
||||
}
|
||||
|
||||
public void RecalculateDynamics()
|
||||
{
|
||||
if (!(transitPoint == null) && GameUtils.IsTransitPointValid(transitPoint))
|
||||
{
|
||||
screenPosition = GameUtils.WorldPointToScreenPoint(transitPoint.transform.position);
|
||||
IsOnScreen = GameUtils.IsScreenPointVisible(screenPosition);
|
||||
Distance = Vector3.Distance(Main.MainCamera.transform.position, transitPoint.transform.position);
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue