rip jerry

This commit is contained in:
JohnCorby 2023-02-22 20:58:05 -08:00
parent db29e22a1a
commit ce31656ab2
3 changed files with 0 additions and 198 deletions

View File

@ -528,7 +528,6 @@ namespace NewHorizons
{
Locator.GetPlayerBody().gameObject.AddComponent<DebugRaycaster>();
Locator.GetPlayerBody().gameObject.AddComponent<DebugPropPlacer>();
Locator.GetPlayerBody().gameObject.AddComponent<DebugNomaiTextPlacer>();
Locator.GetPlayerBody().gameObject.AddComponent<DebugMenu>();
// DebugArrow.CreateArrow(Locator.GetPlayerBody().gameObject); // This is for NH devs mostly. It shouldn't be active in debug mode for now. Someone should make a dev tools submenu for it though.

View File

@ -1,145 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine;
namespace NewHorizons.Utility.DebugUtilities
{
class DebugArrow : MonoBehaviour
{
public Transform target;
public static void CreateArrow(GameObject parent)
{
var arrowGO = new GameObject("ArrowGO");
arrowGO.AddComponent<DebugArrow>();
arrowGO.transform.parent = parent.transform;
arrowGO.transform.localPosition = new Vector3(0, 0, 1f);
}
void Start()
{
// make the mesh in code so we don't need an assetbundle or anything
/* G
* /\
* / \
* E C||D F
* ||
* A B
*/
Vector3[] topVerts = new Vector3[]
{
new Vector3(-0.1f, 0.1f, -0.5f), // A
new Vector3( 0.1f, 0.1f, -0.5f), // B
new Vector3(-0.1f, 0.1f, 0f), // C
new Vector3( 0.1f, 0.1f, 0f), // D
new Vector3(-0.5f, 0.1f, 0f), // E
new Vector3( 0.5f, 0.1f, 0f), // F
new Vector3( 0f, 0.1f, 0.5f), // G
};
Vector3[] bottomVerts = topVerts.Select(vert => new Vector3(vert.x, -vert.y, vert.z)).ToArray();
Vector3[] sideVerts = topVerts.Concat(bottomVerts).ToArray();
// note: A' is the bottom version of A
var A = 0;
var B = 1;
var C = 2;
var D = 3;
var E = 4;
var F = 5;
var G = 6;
int prime = topVerts.Length;
int[] topTris = new int[]
{
A, C, B, // rectangle bit
B, C, D,
F, E, G, // pointy bit
};
int[] bottomTris =
{
A+prime, B+prime, C+prime, // rectangle bit
B+prime, D+prime, C+prime,
F+prime, G+prime, E+prime, // pointy bit
};
/* G
* /\
* / \
* E C||D F
* ||
* A B
*
* Right side view
* B D F G
* +---------+---+
* | 1 | 2 |
* +---------+---+
* B' D' F' G'
*
* Left Side view
* G E C A
* +---+----------+
* | 3 | 4 |
* +---+----------+
* G' E' C' A'
*
* Back view
* E C D F
* +-+---+-+
* |5| 6 |7|
* +-+---+-+
* E' C' D' F'
*/
int[] sideTris = new int[]
{
B+prime, B, D+prime, // 1
D+prime, B, D,
F+prime, F, G+prime, // 2
G+prime, F, G,
G+prime, G, E+prime, // 3
E+prime, G, E,
C+prime, C, A+prime, // 4
A+prime, C, A,
E+prime, E, C+prime, // 5
C+prime, E, C,
C+prime, D+prime, C, // 6
D+prime, D, C,
D+prime, D, F+prime, // 7
F+prime, D, F,
}.Select(vIdx => vIdx + topVerts.Length+bottomVerts.Length).ToArray();
Mesh m = new Mesh();
m.name = "DebugArrow";
m.vertices = topVerts.Concat(bottomVerts).Concat(sideVerts).ToArray();
m.triangles = topTris.Concat(bottomTris).Concat(sideTris).ToArray();
m.RecalculateNormals();
m.RecalculateBounds();
this.gameObject.AddComponent<MeshFilter>().mesh = m;
this.gameObject.AddComponent<MeshRenderer>();
}
private void Update()
{
if (target == null) return;
this.transform.LookAt(target);
}
}
}

View File

@ -1,52 +0,0 @@
using NewHorizons.Handlers;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine;
using UnityEngine.InputSystem;
namespace NewHorizons.Utility.DebugUtilities
{
class DebugNomaiTextPlacer : MonoBehaviour
{
public static bool active;
public Action<DebugRaycastData> onRaycast;
private DebugRaycaster _rc;
private ScreenPrompt _placePrompt;
private void Awake()
{
_rc = this.GetComponent<DebugRaycaster>();
_placePrompt = new ScreenPrompt(TranslationHandler.GetTranslation("DEBUG_PLACE_TEXT", TranslationHandler.TextType.UI) + " <CMD>", ImageUtilities.GetButtonSprite(KeyCode.G));
Locator.GetPromptManager().AddScreenPrompt(_placePrompt, PromptPosition.UpperRight, false);
}
private void OnDestroy()
{
Locator.GetPromptManager()?.RemoveScreenPrompt(_placePrompt, PromptPosition.UpperRight);
}
private void Update()
{
UpdatePromptVisibility();
if (!Main.Debug) return;
if (!active) return;
if (Keyboard.current[Key.G].wasReleasedThisFrame)
{
DebugRaycastData data = _rc.Raycast();
if (onRaycast != null) onRaycast.Invoke(data);
}
}
public void UpdatePromptVisibility()
{
_placePrompt.SetVisibility(!OWTime.IsPaused() && Main.Debug && active);
}
}
}