void Awake() { cubeSpawner = GameObject.FindGameObjectWithTag("LineSpawner").GetComponent <CubeSpawner>(); playerController = GameObject.Find("Player").GetComponent <PlayerController>(); scoreManager = GameObject.FindGameObjectWithTag("ScoreManager").GetComponent <ScoreManager>(); particleController = GameObject.FindGameObjectWithTag("ParticleController").GetComponent <RotateParticles>(); uiManager = GameObject.FindGameObjectWithTag("UIManager").GetComponent <UIManager>(); burstParticles = GameObject.FindGameObjectWithTag("BurstParticleController").GetComponent <BurstParticleController>(); transform.localScale = new Vector3(PlayerController.aspectScale, transform.localScale.y, PlayerController.aspectScale); rotateSpeed = playerController.rotateSpeed; int randColor = Random.Range(1, 6); switch (randColor) { case 1: GetComponent <Renderer>().material = cubeSpawner.colorArray[0]; tag = "Red"; break; case 2: GetComponent <Renderer>().material = cubeSpawner.colorArray[1]; tag = "Blue"; break; case 3: GetComponent <Renderer>().material = cubeSpawner.colorArray[2]; tag = "Yellow"; break; case 4: GetComponent <Renderer>().material = cubeSpawner.colorArray[3]; tag = "Green"; break; case 5: GetComponent <Renderer>().material = cubeSpawner.colorArray[4]; tag = "Purple"; break; default: Debug.Log("Something went wrong within the switch @ " + this); break; } }
void Awake() { cubeSpawner = GameObject.FindGameObjectWithTag("LineSpawner").GetComponent <CubeSpawner>(); particleController = GameObject.FindGameObjectWithTag("ParticleController").GetComponent <RotateParticles>(); aspectScale = Camera.main.aspect; transform.localScale = new Vector3(aspectScale, aspectScale, aspectScale); float distance = transform.position.z - Camera.main.transform.position.z; Vector3 leftMostSide = Camera.main.ViewportToWorldPoint(new Vector3(0, 0, distance)); Vector3 rightMostSide = Camera.main.ViewportToWorldPoint(new Vector3(1, 0, distance)); xMin = leftMostSide.x + screenPadding; xMax = rightMostSide.x - screenPadding; initialRotateSpeed = rotateSpeed; ChangeColor(); }
void Awake() { rotateModel = mainModel.GetComponent <RotateParticles>(); animator = destructionModel.GetComponentInChildren <Animator>(); }