Exemple #1
0
    public const float Z = 10f;              // The z-position of the background

    // Update is called once per frame
    void Update()
    {
        // If the height of the camera has changed
        if (currentHeight != CameraScaler.GetCurrentCameraHeight())
        {
            // Update the background height and position
            currentHeight        = CameraScaler.GetCurrentCameraHeight();
            transform.localScale = new Vector3(GameArea.WIDTH, currentHeight, 1f);                          // Set the width and length of the background sprite
            transform.position   = new Vector3(CameraScaler.CAMERA_X, CameraScaler.GetCurrentCameraY(), Z); // Set the position of the background sprite
        }
    }
    void Start()
    {
        levelData     = FindObjectOfType(typeof(LevelData)) as LevelData;
        colorScript   = FindObjectOfType(typeof(ColorScript)) as ColorScript;
        counterScript = FindObjectOfType(typeof(InGameBallCounterScript)) as InGameBallCounterScript;
        cameraScaler  = FindObjectOfType(typeof(CameraScaler)) as CameraScaler;


        reversedCameraQuaternion = new Quaternion(180f, 0, 0, 0);

        CreateLevel();
    }
Exemple #3
0
 private void Awake()
 {
     inst = this;
 }
 public static float GetCurrentMaxY()
 {
     return(CameraScaler.GetCameraMaxY());
 }