예제 #1
0
    private void Update()
    {
        if (GameManager.instance.designingLevel)
        {
            return;                                       // None of this should apply if we are designing the level
        }
        camTop         = Mathf.Max(maxPlayerHeight, baseMapHeight);
        baseMapHeight += Time.deltaTime * mapSpeed;

        if (!GameManager.instance.playerSpanwed)
        {
            return;
        }

        Vector2 blobBounds = AllSlimes.singleton.getHorizontalBounds();
        float   boundsSize = (blobBounds.y - blobBounds.x) * 1.1f / mapCam.aspect;

        mapCam.orthographicSize   = Mathf.Max(boundsSize, baseCamSize); // TODO is this needed
        mapCam.transform.position = new Vector3((blobBounds.y + blobBounds.x) / 2f, mapCam.transform.position.y, mapCam.transform.position.z);

        spikes.positionSpikes();
    }