Thursday, 14 March 2013

Player Control Script

using UnityEngine;using System.Collections;

public class PlayerControl : MonoBehaviour
{

public GUIText tmMessage;

public GameObject RespawnManager;
public void Died()

{

tmMessage.text = "You have died, respawning...";
 
 //disable first person controller script

gameObject.SendMessage ("SetControllable", false);
//call the cleanup method after 5seconds

Invoke ("CleanUp", 5F); 
}
private void CleanUp()

{

tmMessage.text = "";


//Enable first person controller script

gameObject.SendMessage ("SetControllable", true); 
 //Respawn the player

RespawnManager.SendMessage("RespawnPlayer"); 
}


// Use this for initialization

void Start ()

{

CleanUp();

}


// Update is called once per frame

void Update () {

 
}

}

Here is the other lot of script for the respawn point script.

No comments:

Post a Comment