Exemple #1
0
 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;
 }
Exemple #2
0
 private void Awake()
 {
     if (Instance == null)
     {
         _instance = this;
     }
 }
Exemple #3
0
    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);
     }
 }
Exemple #5
0
    public static CameraSingleton instance;     //카메라 싱글톤 용

    #region Singleton
    private void Awake()
    {
        if (instance == null)
        {
            DontDestroyOnLoad(gameObject);
            instance = this;
        }
        else
        {
            Destroy(gameObject);
        }
    }
Exemple #6
0
 private void Awake()
 {
     // Only let there be one instance of the camera
     if (singleton == null)
     {
         singleton = this;
     }
     else if (singleton != this)
     {
         Destroy(gameObject);
     }
 }
Exemple #7
0
 void Awake()
 {
     if (Instance == null)
     {
         Instance = this;
         DontDestroyOnLoad(this.gameObject);
     }
     else
     {
         Destroy(gameObject);
     }
 }
Exemple #8
0
    private void Awake()
    {
        if (Instance != null && Instance != this)
        {
            Destroy(gameObject);
        }
        else
        {
            Instance = this;
        }

        DontDestroyOnLoad(gameObject);
    }
Exemple #9
0
    private void Awake()
    {
        if (Instance != null)
        {
            Destroy(this.gameObject);
            return;
        }

        Instance = this;
#if !UNITY_EDITOR
        activeCamera = ARCamera;
#else
        activeCamera = TestCamera;
#endif
    }
Exemple #10
0
 void Awake()
 {
     Instance = this;
 }