Exemplo n.º 1
0
    public void updateCamera()
    {
        Vector3 screenPos = Camera.main.WorldToScreenPoint(player.transform.position);
        // check if the player's center screen position is above or below a threshold off the screen
        bool outsideArea = (screenPos.y <(0.2f * Screen.height) || screenPos.y> (0.9f * Screen.height));

        if (outsideArea)
        {
            bool isActive = GameObjectTools.isActive(player.gameObject);
            if (!applied && !player.isDying() && isActive)
            {
                xyConfig.lockY = false;
                camPosYCorrection.correctPosY();
                applied = true;
            }
        }
        else
        {
            applied = false;
        }
    }