using UnityEngine;
|
|
using System.Collections;
|
|
|
|
public class respawners : MonoBehaviour {
|
|
|
|
private bool player1;
|
|
private bool player2;
|
|
|
|
public GameObject respawnPoint;
|
|
public GameObject deathTrigger;
|
|
|
|
private checkpoint deathScript;
|
|
|
|
// Use this for initialization
|
|
void Start () {
|
|
deathScript = deathTrigger.GetComponent<checkpoint> ();
|
|
}
|
|
|
|
// Update is called once per frame
|
|
void Update () {
|
|
|
|
}
|
|
|
|
void OnTriggerStay(Collider other) {
|
|
if (other.name == "Player1")
|
|
player1 = true;
|
|
if (other.name == "Player2")
|
|
player2 = true;
|
|
|
|
if (player1 && player2) {
|
|
deathTrigger.SetActive(true);
|
|
deathScript.respawnPoint = respawnPoint;
|
|
gameObject.SetActive(false);
|
|
|
|
if (this.transform.tag == "end") {
|
|
Application.LoadLevel("CreditScene");
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
}
|