using UnityEngine; using AppleHills.Core; using Core; namespace AppleHills.Examples { /// /// Example script demonstrating how to use QuickAccess to quickly retrieve and use game objects /// public class QuickAccessExample : MonoBehaviour { void Start() { // Retrieve player and follower objects using QuickAccess GameObject player = QuickAccess.Instance.PlayerGameObject; GameObject follower = QuickAccess.Instance.FollowerGameObject; // Print info about the player if (player != null) { Logging.Debug($"[QuickAccessExample] Player found: {player.name}"); Logging.Debug($"[QuickAccessExample] Player position: {player.transform.position}"); // Access player controller var playerController = QuickAccess.Instance.PlayerController; if (playerController != null) { Logging.Debug($"[QuickAccessExample] Player controller found on object"); } else { Logging.Warning($"[QuickAccessExample] Player controller not found"); } } else { Logging.Warning($"[QuickAccessExample] Player not found in scene"); } // Print info about the follower (Pulver) if (follower != null) { Logging.Debug($"[QuickAccessExample] Follower found: {follower.name}"); Logging.Debug($"[QuickAccessExample] Follower position: {follower.transform.position}"); // Access follower controller var followerController = QuickAccess.Instance.FollowerController; if (followerController != null) { Logging.Debug($"[QuickAccessExample] Follower controller found on object"); } else { Logging.Warning($"[QuickAccessExample] Follower controller not found"); } } else { Logging.Warning($"[QuickAccessExample] Follower not found in scene"); } // Access camera var camera = QuickAccess.Instance.MainCamera; if (camera != null) { Logging.Debug($"[QuickAccessExample] Main camera found: {camera.name}"); Logging.Debug($"[QuickAccessExample] Camera position: {camera.transform.position}"); } else { Logging.Warning($"[QuickAccessExample] Main camera not found"); } // Access managers try { Logging.Debug($"[QuickAccessExample] Game Manager instance accessed: {QuickAccess.Instance.GameManager != null}"); Logging.Debug($"[QuickAccessExample] Input Manager instance accessed: {QuickAccess.Instance.InputManager != null}"); } catch (System.Exception e) { Debug.LogError($"[QuickAccessExample] Error accessing managers: {e.Message}"); } } } }