void Awake() { controllerScript = GameObject.Find("Main Camera").GetComponent <ControllerScript>(); snowball = GameObject.Find("Snowball"); snowballLaserScript = (CatLaserScript)snowball.GetComponent(typeof(CatLaserScript)); snowballLaserScript.enabled = false; snowballRigidBody = snowball.GetComponent <Rigidbody>(); snowballRigidBody.isKinematic = true; snowballAudioSource = snowball.GetComponent <AudioSource>(); snowballAnim = snowball.GetComponent <Animator>(); introHash = Animator.StringToHash("Intro"); laserPointer = GameObject.Find("LaserPointer"); laserPointer.SetActive(false); balls = GameObject.FindGameObjectsWithTag("Ball"); foreach (GameObject ball in balls) { ball.SetActive(false); } blocks = GameObject.FindGameObjectsWithTag("Block"); foreach (GameObject block in blocks) { block.SetActive(false); } snowballBedRigidBody = GameObject.Find("SnowballBed").GetComponent <Rigidbody>(); snowballBedRigidBody.isKinematic = true; mainSongAudioSource = GameObject.Find("MainSong").GetComponent <AudioSource>(); introSongAudioSource = GameObject.Find("IntroSong").GetComponent <AudioSource>(); introSongAudioSource.Play(); pointLight = GameObject.Find("PointLight").GetComponent <Light>(); pointLight.intensity = 0; crosshair = GameObject.Find("Crosshair"); crosshair.SetActive(false); iconController = GameObject.Find("Icon Controller"); iconController.SetActive(false); icons = GameObject.FindGameObjectsWithTag("Icon"); foreach (GameObject icon in icons) { icon.SetActive(false); } quads = GameObject.FindGameObjectsWithTag("Quad"); foreach (GameObject quad in quads) { quad.SetActive(false); } pathPointGameObjects = GameObject.FindGameObjectsWithTag("PathPoint"); pathPointTransforms = new Transform[pathPointGameObjects.Length]; for (int i = 0; i < pathPointTransforms.Length; i++) { pathPointTransforms[int.Parse(pathPointGameObjects[i].name.Substring(9, 1))] = pathPointGameObjects[i].transform; } currPathPoint = 0; targetPathPoint = null; pathFinished = false; introSongFinished = false; snowballAnim.Play(introHash); }
void Start() { mainCamera = GameObject.Find("Main Camera"); cats = GameObject.FindGameObjectsWithTag("Cat"); foreach (GameObject cat in cats) { currCat = cat; catLaserScript = (CatLaserScript)currCat.GetComponent(typeof(CatLaserScript)); } }