//public Rigidbody UseGravity; // Use this for initialization void Start() { Rabbit1 = GameObject.Find("Rabbit1"); Rabbit2 = GameObject.Find("Rabbit2"); Rabbit3 = GameObject.Find("Rabbit3"); Rabbit4 = GameObject.Find("Rabbit4"); Rabbit5 = GameObject.Find("Rabbit5"); Rabbit6 = GameObject.Find("Rabbit6"); Rabbit7 = GameObject.Find("Rabbit7"); Rabbit8 = GameObject.Find("Rabbit8"); Rabbit9 = GameObject.Find("Rabbit9"); AudioSource = GameObject.Find("AudioSource"); FlyingDistance = GameObject.Find("FlyingDistance"); Fireworks1 = GameObject.Find("Fireworks1"); Fireworks2 = GameObject.Find("Fireworks2"); Fireworks3 = GameObject.Find("Fireworks3"); Fireworks4 = GameObject.Find("Fireworks4"); Fireworks5 = GameObject.Find("Fireworks5"); Fireworks6 = GameObject.Find("Fireworks6"); Fireworks7 = GameObject.Find("Fireworks7"); Kim = GameObject.Find("Kim"); particleSystem = GetComponent <ParticleSystem>(); BallCameraController = GetComponent <BallCameraController>(); MainCamera = GameObject.Find("Main Camera").GetComponent <Camera>(); CenterCamera = GameObject.Find("Center Camera").GetComponent <Camera>(); LeftCamera = GameObject.Find("Left Camera").GetComponent <Camera>(); RightCamera = GameObject.Find("Right Camera").GetComponent <Camera>(); BallCamera = GameObject.Find("Ball Camera").GetComponent <Camera>(); MainCamera.enabled = true; CenterCamera.enabled = false; LeftCamera.enabled = false; RightCamera.enabled = false; BallCamera.enabled = false; AnimationController = GetComponent <AnimationController>(); Ball = GetComponent <Rigidbody>(); Ball.useGravity = false; StrikeController = GetComponent <StrikeController>(); Cube = GameObject.Find("Cube"); catcherPos = new Vector3(Cube.transform.position.x, Cube.transform.position.y, 0) + new Vector3(Random.Range(-1.5f, 2.5f), Random.Range(-1.5f, 1.5f), 0); ballPos = new Vector3(this.Ball.transform.position.x, this.Ball.transform.position.y, -this.Ball.transform.position.z); strikeZone = catcherPos - ballPos; power = 40.0f; BallCameraPosition = new Vector3(BallCamera.transform.position.x, BallCamera.transform.position.y, BallCamera.transform.position.z); ballPosition = transform.position; diffrence = ballPosition - this.transform.position; //Homerun1 = new Vector3(-3.0f, 217.0f, -364.0f); //Homerun1Pos = Homerun1 - ballPos; }
void OnEnable() { if (Configuration == null) { Debug.LogWarning("Level's Dual Cameras does not have a color configuration set."); return; } LightCamera.EffectMaterial = Configuration.LightMaterial; DarkCamera.EffectMaterial = Configuration.DarkMaterial; LightCamera.SetMaterialInstance(); DarkCamera.SetMaterialInstance(); _lightCameraController = LightCamera.GetComponent <BallCameraController>(); _darkCameraController = DarkCamera.GetComponent <BallCameraController>(); }