added an arrow that can point at whatever you want

This commit is contained in:
FreezeDriedMangoes 2022-06-13 23:09:10 -04:00
parent 43b29e7775
commit ee519a24d5
4 changed files with 134 additions and 23 deletions

View File

@ -285,7 +285,8 @@ namespace NewHorizons
Locator.GetPlayerBody().gameObject.AddComponent<DebugRaycaster>();
Locator.GetPlayerBody().gameObject.AddComponent<DebugPropPlacer>();
Locator.GetPlayerBody().gameObject.AddComponent<DebugNomaiTextPlacer>();
Locator.GetPlayerBody().gameObject.AddComponent<DebugMenu>();
Locator.GetPlayerBody().gameObject.AddComponent<DebugMenu>();
DebugArrow.CreateArrow(Locator.GetPlayerBody().gameObject);
if (shouldWarpIn) _shipWarpController.WarpIn(WearingSuit);
else FindObjectOfType<PlayerSpawner>().DebugWarp(SystemDict[_currentStarSystem].SpawnPoint);

View File

@ -1,14 +1,15 @@
using HarmonyLib;
using HarmonyLib;
namespace NewHorizons.Patches;
[HarmonyPatch]
public class AutoSlideProjectorPatches
{
[HarmonyPostfix]
[HarmonyPatch(typeof(AutoSlideProjector), nameof(AutoSlideProjector.Play))]
public static void AutoSlideProjector_Play(ref SlideCollectionContainer ____slideCollectionItem)
namespace NewHorizons.Patches
{
[HarmonyPatch]
public class AutoSlideProjectorPatches
{
____slideCollectionItem.enabled = true;
}
}
[HarmonyPostfix]
[HarmonyPatch(typeof(AutoSlideProjector), nameof(AutoSlideProjector.Play))]
public static void AutoSlideProjector_Play(ref SlideCollectionContainer ____slideCollectionItem)
{
____slideCollectionItem.enabled = true;
}
}
}

View File

@ -364,6 +364,8 @@ namespace NewHorizons.Utility.DebugMenu
//var wallTextComponent = conversationZone.GetComponent<NomaiWallText>();
//foreach(NomaiTextLine l in wallTextComponent._textLines) GameObject.Destroy(l.gameObject);
//NomaiTextBuilder.RefreshArcs(wallTextComponent, conversationZone, spiralMeta.conversation);
Locator.GetPlayerBody().gameObject.GetComponentInChildren<DebugArrow>().target = spiralMeta.spiralGo.transform;
}
GUILayout.Space(10);

View File

@ -11,27 +11,134 @@ namespace NewHorizons.Utility.DebugUtilities
{
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
/* E
* (0, .5)
/* G
* /\
* / \
* C (-.5,0) || (.5,0) D
* E C||D F
* ||
* (-.1,-.5) (.1,-.5)
* A B
* A B
*/
Vector3[] topVerts = new Vector3[]
{
new Vector3(-0.1f, -0.5f, 0.1f), // A
new Vector3( 0.1f, -0.5f, 0.1f), // B
new Vector3(-0.5f, 0f, 0.1f), // C
new Vector3( 0.5f, 0f, 0.1f), // D
new Vector3( 0f, 0.5f, 0.1f), // E
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.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);
}
}
}