// Use this for initialization void Start() { bcs = gameObject.GetComponent <BirdCarryScript>(); bms = gameObject.GetComponent <BirdMoveScript>(); wingFlap = gameObject.GetComponent <AudioSource>(); animator = gameObject.GetComponent <Animator>(); flightMeter = 1.35f; }
private void Start() { AudioSource[] audioSource = GetComponents <AudioSource>(); bms = GetComponent <BirdMoveScript>(); bcs = gameObject.GetComponent <BirdCarryScript>(); grassHop = audioSource[1]; logHop = audioSource[2]; mainCamera = GameObject.FindGameObjectWithTag("MainCamera"); }
// Update is called once per frame void Update() { //float playerRot = GameObject.FindGameObjectWithTag("Player").GetComponent("rotAngle"); float playerRot = BirdMoveScript.GetRotAngle(); float playerRadius = playerMoveScript.GetRadius(); float camRadius = 7.0f; // Debug.Log("playerRot: " + playerRot); //Camera thisCam = gameObject.GetComponent<Camera>(); //gameObject.transform.rotation = Quaternion.Euler(-playerRot, gameObject.transform.rotation.y, gameObject.transform.rotation.z); gameObject.transform.position = new Vector3((camRadius + playerRadius) * Mathf.Sin(Mathf.Deg2Rad * playerRot), gameObject.transform.position.y, (camRadius + playerRadius) * -Mathf.Cos(Mathf.Deg2Rad * playerRot)); gameObject.transform.LookAt(GameObject.FindGameObjectWithTag("Player").transform, new Vector3(0, 1, 0)); }
// Use this for initialization void Start() { playerMoveScript = GameObject.FindGameObjectWithTag("Player").GetComponent <BirdMoveScript>(); }