UniformAim/TarkovUniformAim/UniformAimUtils.cs

67 lines
2.0 KiB
C#
Raw Normal View History

using Comfort.Common;
using EFT;
using UnityEngine;
namespace UniformAim
{
public class Utils
{
public static bool isPlaying = false;
public static GameObject rootObject = null;
public static bool checkIsReady()
{
var gameWorld = Singleton<GameWorld>.Instance;
var sessionResultPanel = Singleton<SessionResultPanel>.Instance;
if (gameWorld == null
|| gameWorld.AllPlayers == null
|| gameWorld.AllPlayers.Count <= 0
|| sessionResultPanel != null)
{
return false;
}
return true;
}
public static bool checkPlayerIsAlive()
{
var gameWorld = Singleton<GameWorld>.Instance;
var currentHealth = gameWorld.AllPlayers[0].HealthController.GetBodyPartHealth(EBodyPart.Common).Current;
if (currentHealth > 0) { return true; } else { return false; }
}
public static GameObject SetRootObject()
{
string path = "Common UI/Common UI/SettingsScreen";
if(GameObject.Find(path) != null)
{
GameObject rootObject = GameObject.Find(path);
return rootObject;
}
else { return null; }
}
public static int GetInGameFOV(GameObject root)
{
GameObject fovObject = root.transform.Find("Game Settings/Image/Other Settings/FOV/FOV").gameObject;
int rootFOV = fovObject.GetComponent<EFT.UI.SelectSlider>().CurrentValue();
return rootFOV;
}
public static float GetInGameSens(GameObject root)
{
GameObject sensObject = root.transform.Find("Control Settings/ControlPanel/Mouse Settings/Sensitivity Aiming Panel/Mouse Sensitivity Aiming").gameObject;
float rootSens = sensObject.GetComponent<EFT.UI.FloatSlider>().CurrentValue();
return rootSens;
}
}
}