public static void RenderClosestChest() { var chest = FindClosestChest(); Vector3 chestPosition = Camera.main.WorldToScreenPoint(chest.transform.position); var chestBoundingVector = new Vector3(chestPosition.x, chestPosition.y, chestPosition.z); if (chestBoundingVector.z > 0.01) { string dropNameColored = Util.GenerateColoredString(Language.GetString(chest.GetField <PickupIndex>("dropPickup").GetPickupNameToken()), chest.GetField <PickupIndex>("dropPickup").GetPickupColor()); float distanceToChest = Vector3.Distance(Camera.main.transform.position, FindClosestChest().transform.position); float width = 100f * (distanceToChest / 100); if (width > 125) { width = 125; } float height = 100f * (distanceToChest / 100); if (height > 125) { height = 125; } if (Main.renderInteractables) { GUI.Label(new Rect(chestBoundingVector.x - 50f, (float)Screen.height - chestBoundingVector.y + 35f, 100f, 50f), $"Selected Chest", Main.selectedChestStyle); } else { GUI.Label(new Rect(chestBoundingVector.x - 50f, (float)Screen.height - chestBoundingVector.y + 35f, 100f, 50f), $"Selected Chest\n{dropNameColored}", Main.selectedChestStyle); } ESPHelper.DrawBox(chestBoundingVector.x - width / 2, (float)Screen.height - chestBoundingVector.y - height / 2, width, height, new Color32(0, 0, 255, 255)); } }
public static void Mobs() { foreach (var hurtbox in Main.hurtBoxes) { var mob = HurtBox.FindEntityObject(hurtbox); if (mob) { Vector3 MobPosition = Camera.main.WorldToScreenPoint(mob.transform.position); var MobBoundingVector = new Vector3(MobPosition.x, MobPosition.y, MobPosition.z); float distanceToMob = Vector3.Distance(Camera.main.transform.position, mob.transform.position); if (MobBoundingVector.z > 0.01) { float width = 100f * (distanceToMob / 100); if (width > 125) { width = 125; } float height = 100f * (distanceToMob / 100); if (height > 125) { height = 125; } string mobName = mob.name.Replace("Body(Clone)", ""); int mobDistance = (int)distanceToMob; string mobBoxText = $"{mobName}\n{mobDistance}m"; GUI.Label(new Rect(MobBoundingVector.x - 50f, (float)Screen.height - MobBoundingVector.y + 50f, 100f, 50f), mobBoxText, Main.renderMobsStyle); ESPHelper.DrawBox(MobBoundingVector.x - width / 2, (float)Screen.height - MobBoundingVector.y - height / 2, width, height, new Color32(255, 0, 0, 255)); } } } }