void Update() { pos = CameraSingleton.GetCamera().WorldToScreenPoint(player.transform.position); if (pos.x > warpWidth) { Vector3 newPos = new Vector3(0f, pos.y, pos.z); Vector3 worldPos = CameraSingleton.CameraPositionToScenario(newPos); Debug.Log("Pos: " + worldPos); player.Teleport(new Vector3(worldPos.x, player.transform.position.y, worldPos.z)); } if (pos.y > warpHeight) { Vector3 newPos = new Vector3(pos.x, 0f, pos.z); Vector3 worldPos = CameraSingleton.CameraPositionToScenario(newPos); Debug.Log("Pos: " + worldPos); player.Teleport(new Vector3(worldPos.x, player.transform.position.y, worldPos.z)); } if (pos.x < warpZeroWidth) { Vector3 newPos = new Vector3(screenWidth, pos.y, pos.z); Vector3 worldPos = CameraSingleton.CameraPositionToScenario(newPos); Debug.Log("Pos: " + worldPos); player.Teleport(new Vector3(worldPos.x, player.transform.position.y, worldPos.z)); } if (pos.y < warpZeroHeight) { Vector3 newPos = new Vector3(pos.x, screenHeight, pos.z); Vector3 worldPos = CameraSingleton.CameraPositionToScenario(newPos); Debug.Log("Pos: " + worldPos); player.Teleport(new Vector3(worldPos.x, player.transform.position.y, worldPos.z)); } P1CanvasX = pos.x; P1CanvasY = pos.z; }
private void Awake() { if (Instance == null) { _instance = this; } }
void Start() { screenHeight = CameraSingleton.GetPixelHeight(); screenWidth = CameraSingleton.GetPixelWidth(); warpHeight = screenHeight + screenHeight * warpOffsetMultiplier; warpWidth = screenWidth + screenWidth * warpOffsetMultiplier; warpZeroHeight = 0 - screenHeight * warpOffsetMultiplier; warpZeroWidth = 0 - screenWidth * warpOffsetMultiplier; }
private void Awake() { if (instance == null) { instance = this; } else if (instance != this) { Destroy(this.gameObject); } }
public static CameraSingleton instance; //카메라 싱글톤 용 #region Singleton private void Awake() { if (instance == null) { DontDestroyOnLoad(gameObject); instance = this; } else { Destroy(gameObject); } }
private void Awake() { // Only let there be one instance of the camera if (singleton == null) { singleton = this; } else if (singleton != this) { Destroy(gameObject); } }
void Awake() { if (Instance == null) { Instance = this; DontDestroyOnLoad(this.gameObject); } else { Destroy(gameObject); } }
private void Awake() { if (Instance != null && Instance != this) { Destroy(gameObject); } else { Instance = this; } DontDestroyOnLoad(gameObject); }
private void Awake() { if (Instance != null) { Destroy(this.gameObject); return; } Instance = this; #if !UNITY_EDITOR activeCamera = ARCamera; #else activeCamera = TestCamera; #endif }
void Awake() { Instance = this; }