You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

50 lines
807 B

  1. using UnityEngine;
  2. using System.Collections;
  3. public class respawners : MonoBehaviour {
  4. private bool player1;
  5. private bool player2;
  6. public GameObject respawnPoint;
  7. public GameObject deathTrigger;
  8. public bool objective = false;
  9. private checkpoint deathScript;
  10. // Use this for initialization
  11. void Start () {
  12. deathScript = deathTrigger.GetComponent<checkpoint> ();
  13. }
  14. // Update is called once per frame
  15. void Update () {
  16. }
  17. void OnTriggerStay(Collider other) {
  18. if (other.name == "Player1")
  19. player1 = true;
  20. if (other.name == "Player2")
  21. player2 = true;
  22. if (player1 && player2) {
  23. if (objective) {
  24. Application.LoadLevel("CreditScreen");
  25. }
  26. deathTrigger.SetActive(true);
  27. deathScript.respawnPoint = respawnPoint;
  28. gameObject.SetActive(false);
  29. }
  30. }
  31. }