// Use this for initialization void Start() { cylinderX = GameObject.FindGameObjectWithTag("Center Cylinder").transform.position.x; cylinderZ = GameObject.FindGameObjectWithTag("Center Cylinder").transform.position.z; birdBody = gameObject.GetComponent <Rigidbody>(); bcs = gameObject.GetComponent <BirdCarryScript>(); #if UNITY_EDITOR // Debug.Log("XZ (" + cylinderX + ", " + cylinderZ + ")"); #endif rotAngle = 155.0f; radius = 42.5f; isAirborne = false; isFalling = false; //Fix for animation not playing animator = gameObject.GetComponent <Animator>(); moveLockTimer = 0.0f; firstHopMoveLockTime = 0.25f; takeOffMoveLockTime = 0.4f; flyCountdown = takeOffMoveLockTime; takeOffPrep = false; moveLocked = false; firstMove = true; playerMoveDir = CardinalMoveDir.east; spinAngle = 0.0f; spinSpeed = 300.0f; }
private void OnTriggerEnter(Collider collider) { Debug.Log("Collide"); switch (collider.gameObject.tag) { case "Worm": Debug.Log("WORM"); if (!BirdCarryScript.IsMouthCarrying()) { collider.gameObject.SendMessage("SetCarried", true); BirdCarryScript.StartMouthCarry(collider.gameObject); } break; case "Baby Bird": if (BirdCarryScript.IsMouthCarrying()) { Debug.Log("Feed Worm"); BirdCarryScript.EndMouthCarry(); collider.gameObject.SendMessage("GetFed"); //TODO: delete worm } else { Debug.Log("Baby Bird"); } break; case "Player": Debug.Log("Player Hit Worm"); break; } }
// 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"); }