コード例 #1
0
    void Update()
    {
        Vector2 screenPosition      = Camera.main.WorldToScreenPoint(transform.position);
        bool    amIInEnlargedScreen = IsOnScreen(screenPosition);

        //bool isCameraInMyChunk = IsInMyChunk(Camera.main.transform.position);
        if (mapScript.IsInBoundingRect(Camera.main.transform.position))
        {
            if (amIInEnlargedScreen)
            {
                TryConnect();
                if (isConnected)
                {
                    TryLoadConnectedChunk();
                }
            }
            else
            {
                if (isConnected)
                {
                    TryUnloadConnectedChunk();
                }
            }
        }
    }