feat: initial commit
This commit is contained in:
37
Helpers/GUIHelper.cs
Normal file
37
Helpers/GUIHelper.cs
Normal file
@@ -0,0 +1,37 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace SlimeRanger.Helpers
|
||||
{
|
||||
internal class GUIHelper
|
||||
{
|
||||
private static float R;
|
||||
private static float G;
|
||||
private static float B;
|
||||
|
||||
public static Color ColorPick(string title, Color color)
|
||||
{
|
||||
GUI.Label(new Rect(Screen.width - 120, 65, 100, 30), title);
|
||||
R = GUI.VerticalSlider(new Rect(Screen.width - 100, 90, 30, 100), color.r, 0f, 1f);
|
||||
G = GUI.VerticalSlider(new Rect(Screen.width - 70, 90, 30, 100), color.g, 0f, 1f);
|
||||
B = GUI.VerticalSlider(new Rect(Screen.width - 40, 90, 30, 100), color.b, 0f, 1f);
|
||||
GUI.Label(new Rect(Screen.width - 100, 190, 30, 30), "R");
|
||||
GUI.Label(new Rect(Screen.width - 70, 190, 30, 30), "G");
|
||||
GUI.Label(new Rect(Screen.width - 39, 190, 30, 30), "B");
|
||||
color = new Color(R, G, B, 1);
|
||||
GUI.color = color;
|
||||
|
||||
void DrawPreview(Rect position, Color color_to_draw)
|
||||
{
|
||||
Texture2D texture = new Texture2D(1, 1);
|
||||
texture.SetPixel(0, 0, color);
|
||||
texture.Apply();
|
||||
GUI.skin.box.normal.background = texture;
|
||||
GUI.Box(position, GUIContent.none);
|
||||
}
|
||||
|
||||
DrawPreview(new Rect(Screen.width - 130, 90, 20, 100), color);
|
||||
|
||||
return color;
|
||||
}
|
||||
}
|
||||
}
|
||||
17
Helpers/StateHelpers.cs
Normal file
17
Helpers/StateHelpers.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace SlimeRanger.Helpers
|
||||
{
|
||||
internal class StateHelpers
|
||||
{
|
||||
public static PlayerState GetPlayerState()
|
||||
{
|
||||
return UnityEngine.Object.FindObjectOfType<PlayerState>();
|
||||
}
|
||||
public static Vector3 GetPlayerPosition()
|
||||
{
|
||||
TeleportablePlayer tpp = UnityEngine.Object.FindObjectOfType<TeleportablePlayer>();
|
||||
return tpp.playerEventHandler.Position.Get();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user