public static void LogInteractables() { PlayerControls[] playerControlsArray = Object.FindObjectsOfType <PlayerControls>(); PlayerControls bot = playerControlsArray[1]; BindingFlags bindFlags = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static; MethodInfo findNearbyMethod = playerControlsArray[1].GetType().GetMethod("FindNearbyObjects", bindFlags); PlayerControls.InteractionObjects interactionObjects = (PlayerControls.InteractionObjects) findNearbyMethod.Invoke(bot, new object[] {}); if (interactionObjects.m_gridLocation != null) { Vector3 position = interactionObjects.m_gridLocation.AccessGridManager.GetPosFromGridLocation( interactionObjects .m_gridLocation.GridIndex); Logger.Log($"interactionObject location: {Logger.FormatPosition(position)}"); } if (interactionObjects.m_interactable != null) { string interactableName = interactionObjects.m_interactable.name; Logger.Log($"Interactable: {interactableName}"); } if (interactionObjects.m_TheOriginalHandlePickup != null) { string originalName = interactionObjects.m_TheOriginalHandlePickup.name; Logger.Log($"Can handle pickup: {originalName}"); } }
public static GameObject GetHighlightedObject(PlayerControls playerControls) { PlayerControls.InteractionObjects interactionObjects = GetInteractionObjects(playerControls); if (interactionObjects.m_TheOriginalHandlePickup != null) { return(interactionObjects.m_TheOriginalHandlePickup); } return(null); }
public static Vector3 GetHighlightedPosition(PlayerControls playerControls) { PlayerControls.InteractionObjects interactionObjects = GetInteractionObjects(playerControls); if (interactionObjects.m_gridLocation != null) { IGridLocation gridLocation = interactionObjects.m_gridLocation; return(gridLocation.AccessGridManager.GetPosFromGridLocation(gridLocation.GridIndex)); } return(new Vector3(0, 0, 0)); }