68 lines
1.9 KiB
C#
68 lines
1.9 KiB
C#
using Comfort.Common;
|
|
using EFT;
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
namespace UniformAim
|
|
{
|
|
public class Utils
|
|
{
|
|
//bool isPlaying = false;
|
|
//GameObject rootObject = null;
|
|
|
|
public bool checkIsReady()
|
|
{
|
|
var gameWorld = Singleton<GameWorld>.Instance;
|
|
var sessionResultPanel = Singleton<SessionResultPanel>.Instance;
|
|
|
|
if (gameWorld == null
|
|
|| gameWorld.AllPlayers == null
|
|
|| gameWorld.AllPlayers.Count <= 0
|
|
|| sessionResultPanel != null
|
|
|| Camera.main == null)
|
|
{
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
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 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 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 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;
|
|
}
|
|
}
|
|
}
|