示例#1
0
        // Start is called before the first frame update
        void Start()
        {
            if (thisObjectIsSpawnPoint)
            {
                centerOfTower = this.transform.position;
            }
            mainCam      = Camera.main.GetComponent <CameraMovement>();
            allFloors    = new List <GameObject>();
            lockedFloors = new List <GameObject>();
            fallOffDetectorOutside.SetActive(false);
            fallOffDetectorInside.SetActive(false);

            UIScreens.instance.currentLevel.text        = SceneManager.GetActiveScene().buildIndex.ToString();
            UIScreens.instance.nextLevel.text           = (SceneManager.GetActiveScene().buildIndex + 1).ToString();
            UIScreens.instance.levelProgress.fillAmount = 0f;
            UIScreens.instance.ballCounter.gameObject.SetActive(false);

            // generate level
            allFloors.AddRange(GenerateLevel(chooseTowerType));
            initialCylinderCount = allFloors.Count * allFloors[0].transform.childCount;
            if (chooseTowerType != TowerType.Tetris)
            {
                // assign random colors to all cylinders and remember those colors
                NormalMode.AssignRandomColors(allFloors, cylinderColors);
                // lock them in place
                for (int i = 0; i < allFloors.Count - 8; i++)
                {
                    foreach (Transform cylinder in allFloors[i].transform)
                    {
                        cylinder.GetComponent <Rigidbody>().isKinematic = true;
                    }
                }
            }
            else
            {
                TetrisMode.AssignRandomColors(allFloors, cylinderColors, tetrisDisks);
                UIScreens.instance.comboCounter.text = obstacleThreshold.ToString();
            }

            UIScreens.instance.ShowScreen("start", true);
        }
        // Start is called before the first frame update
        void Start()
        {
            UIScreens.instance.ballCounter.text = ballCount.ToString();

            cm = GetComponent <CameraMovement>();
        }