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.
 
 
 
 

46 lines
789 B

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");
}
}
}
}