private void OnTriggerEnter2D(Collider2D other) { if (other.gameObject.CompareTag("CameraFocus")) { Cam.Focus(other.gameObject.transform, other.transform.localScale.y); } }
private void BecomeAnimal() { mo.enabled = false; mo.gameObject.GetComponent <Rigidbody2D>().bodyType = RigidbodyType2D.Static; animal.enabled = true; /*if(focalPoint != null) * { * focalPoint.transform.position = Vector3.up * -1000; //SetActive(false); * }*/ cam.Focus(animal.transform); cam.TempFocus(focalPoint); Destroy(gameObject); tp.on = false; }
// returns previously active animal and sets new one public void SetActiveAnimal(int new_animal) { Debug.Log("Animal Number: " + new_animal); // If not in the middle of an animal puzzle if (on) { if (sounds.Count <= new_animal) { Debug.Log("Error: Add more sounds to the list on " + gameObject); } else if (Time.timeSinceLevelLoad > 0.1f) { speaker.clip = sounds[new_animal]; speaker.Play(); } animals[new_animal].SetActive(true); animals[new_animal].transform.position = animals[curr_animal].transform.position; animals[new_animal].GetComponent <Rigidbody2D>().velocity = animals[curr_animal].GetComponent <Rigidbody2D>().velocity; cam.Focus(animals[new_animal].transform); for (int i = 0; i < animals.Count; i++) { if (i != new_animal) { animals[i].SetActive(false); } } curr_animal = new_animal; } //else //{ // Debug.Log("Setting animalPanel to False"); // animalPanel.canTransform = false; //} }