separate loader and behaviour to get rid of static crap
This commit is contained in:
parent
97ceb7ebaf
commit
e7699e7744
@ -1 +1 @@
|
|||||||
injector64.exe --dll "D:\Projekt\tarkov-hax\TarkovHax\bin\Debug\TarkovHax.dll" --target EscapeFromTarkov.exe --namespace TarkovHax --class TarkovHaxBehaviour --method Load
|
injector64.exe --dll "D:\Projekt\tarkov-hax\TarkovHax\bin\Debug\TarkovHax.dll" --target EscapeFromTarkov.exe --namespace TarkovHax --class Loader --method Load
|
@ -42,10 +42,10 @@ namespace TarkovHax
|
|||||||
public static void DrawLineStretched(Vector2 lineStart, Vector2 lineEnd, Texture2D texture, int thickness)
|
public static void DrawLineStretched(Vector2 lineStart, Vector2 lineEnd, Texture2D texture, int thickness)
|
||||||
{
|
{
|
||||||
var vector = lineEnd - lineStart;
|
var vector = lineEnd - lineStart;
|
||||||
float num = 57.29578f * Mathf.Atan(vector.y / vector.x);
|
float pivot = 57.29578f * Mathf.Atan(vector.y / vector.x);
|
||||||
if (vector.x < 0f)
|
if (vector.x < 0f)
|
||||||
{
|
{
|
||||||
num += 180f;
|
pivot += 180f;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (thickness < 1)
|
if (thickness < 1)
|
||||||
@ -55,9 +55,9 @@ namespace TarkovHax
|
|||||||
|
|
||||||
int yOffset = (int)Mathf.Ceil((float)(thickness / 2));
|
int yOffset = (int)Mathf.Ceil((float)(thickness / 2));
|
||||||
|
|
||||||
GUIUtility.RotateAroundPivot(num, lineStart);
|
GUIUtility.RotateAroundPivot(pivot, lineStart);
|
||||||
GUI.DrawTexture(new Rect(lineStart.x, lineStart.y - (float)yOffset, vector.magnitude, (float)thickness), texture);
|
GUI.DrawTexture(new Rect(lineStart.x, lineStart.y - (float)yOffset, vector.magnitude, (float)thickness), texture);
|
||||||
GUIUtility.RotateAroundPivot(-num, lineStart);
|
GUIUtility.RotateAroundPivot(-pivot, lineStart);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void DrawLine(Vector2 lineStart, Vector2 lineEnd, Texture2D texture)
|
public static void DrawLine(Vector2 lineStart, Vector2 lineEnd, Texture2D texture)
|
||||||
|
16
TarkovHax/Loader.cs
Normal file
16
TarkovHax/Loader.cs
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace TarkovHax
|
||||||
|
{
|
||||||
|
public class Loader
|
||||||
|
{
|
||||||
|
private static void Load()
|
||||||
|
{
|
||||||
|
new TarkovHaxBehaviour().Load();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -46,6 +46,7 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="GuiHelper.cs" />
|
<Compile Include="GuiHelper.cs" />
|
||||||
|
<Compile Include="Loader.cs" />
|
||||||
<Compile Include="TarkovHaxBehaviour.cs" />
|
<Compile Include="TarkovHaxBehaviour.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
@ -6,7 +6,7 @@ namespace TarkovHax
|
|||||||
{
|
{
|
||||||
public class TarkovHaxBehaviour : MonoBehaviour
|
public class TarkovHaxBehaviour : MonoBehaviour
|
||||||
{
|
{
|
||||||
public static GameObject GameObjectHolder;
|
public GameObject GameObjectHolder;
|
||||||
|
|
||||||
private float _playerNextUpdateTime;
|
private float _playerNextUpdateTime;
|
||||||
private float _lootNextUpdateTime;
|
private float _lootNextUpdateTime;
|
||||||
@ -23,7 +23,7 @@ namespace TarkovHax
|
|||||||
|
|
||||||
private float _maxDrawingDistance = 15000f;
|
private float _maxDrawingDistance = 15000f;
|
||||||
|
|
||||||
private static void Load()
|
public void Load()
|
||||||
{
|
{
|
||||||
GameObjectHolder = new GameObject();
|
GameObjectHolder = new GameObject();
|
||||||
GameObjectHolder.AddComponent<TarkovHaxBehaviour>();
|
GameObjectHolder.AddComponent<TarkovHaxBehaviour>();
|
||||||
@ -31,13 +31,10 @@ namespace TarkovHax
|
|||||||
DontDestroyOnLoad(GameObjectHolder);
|
DontDestroyOnLoad(GameObjectHolder);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void Unload()
|
public void Unload()
|
||||||
{
|
{
|
||||||
var component = GameObjectHolder.GetComponent<TarkovHaxBehaviour>();
|
Destroy(GameObjectHolder);
|
||||||
if (component != null)
|
Destroy(this);
|
||||||
{
|
|
||||||
DestroyImmediate(component, true);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Update()
|
private void Update()
|
||||||
@ -58,7 +55,6 @@ namespace TarkovHax
|
|||||||
{
|
{
|
||||||
ToggleNightVision();
|
ToggleNightVision();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Input.GetKeyDown(KeyCode.KeypadPlus))
|
if (Input.GetKeyDown(KeyCode.KeypadPlus))
|
||||||
{
|
{
|
||||||
IncreaseFov();
|
IncreaseFov();
|
||||||
|
Loading…
Reference in New Issue
Block a user