public static GameObject GetClosestShrineObject() { Tools.Log("a"); var player = GameManager.Instance.PrimaryPlayer; Tools.Log("b"); var talkers = GameObject.FindObjectsOfType <AdvancedShrineController>(); Tools.Log("c"); float dist = float.MaxValue, d; AdvancedShrineController closest = null; foreach (var talker in talkers) { Tools.Log("d"); try { d = Vector2.Distance(talker.sprite.WorldCenter, player.sprite.WorldCenter); if (talker && d < dist) { closest = talker; dist = d; } } catch { } } Tools.Log("e"); Tools.Log(closest); return(closest.gameObject); }
public static void OnShrineUsed(Action <AdvancedShrineController, PlayerController> orig, AdvancedShrineController self, PlayerController playa) { //ETGModConsole.Log(self.displayTextKey); if (self.displayTextKey == "#SHRINE_FALLEN_ANGEL_DISPLAY") { if (!SaveAPIManager.GetFlag(CustomDungeonFlags.USEDFALLENANGELSHRINE)) { SaveAPIManager.SetFlag(CustomDungeonFlags.USEDFALLENANGELSHRINE, true); } } orig(self, playa); }