Esempio n. 1
0
 // Update is called once per frame
 void Update()
 {
     cameraManager.UpdateScreenBounds(transform, Camera.main);
     if (SceneManager.GetActiveScene().name == "Game")
     {
         rightPlank.transform.position = new Vector3(CameraManager.ScreenRightBound() + 1f, rightPlank.transform.position.y);
         leftPlank.transform.position  = new Vector3(CameraManager.ScreenLeftBound() - 1f, leftPlank.transform.position.y);
     }
 }
Esempio n. 2
0
        /// <summary>
        /// Generates plank a plank with 'numHoles' holes
        /// </summary>
        /// <param name="numHoles"></param>
        void GeneratePlank(List <int> numHoles)
        {
            GameObject plank = new GameObject {
                name = "Plank"
            };

            for (int i = 0; i <= plankWidth; i++)
            {
                var intExists =
                    (from hole in numHoles
                     where i == hole
                     select hole).ToList();
                if (intExists.Count > 0)
                {
                }
                else
                {
                    lastSpawnedPlank = (GameObject)Instantiate(block, new Vector2(CameraManager.ScreenLeftBound() + i, spawnHeight), Quaternion.identity);
                    lastSpawnedPlank.transform.parent = plank.transform;
                }
            }
            plank.AddComponent <Plank>();
        }