Народ подскажите куда и что надо написать чтоб после уничтожения геймобъекта появлялась надпись "вы проиграли"?
Код
using UnityEngine;
using UnityEngine.UI;
using System.Collections;
public class PlayControl : MonoBehaviour {
public float speed;
public Text countText;
public Text winText;
private Rigidbody rb;
private int Счет;
public bool UnderWater;
public float Healths = 1;
public Text loseText;
void Start ()
{
rb = GetComponent<Rigidbody> ();
Счет = 0;
SetCountText ();
winText.text = "";
}
void FixedUpdate ()
{
float moveHorizontal = Input.GetAxis ("Horizontal");
float moveVertical = Input.GetAxis ("Vertical");
Vector3 movement = new Vector3 (moveHorizontal, 0.0f, moveVertical);
rb.AddForce (movement * speed);
}
void OnTriggerEnter(Collider other)
{
if (other.gameObject.CompareTag ("Pick Up"))
{
other.gameObject.SetActive (false);
Счет = Счет + 1;
SetCountText ();
}
if (other.GetComponent<Collider>().CompareTag ("Water"))
{
UnderWater = true;
Healths -= Time.deltaTime;
}
}
void SetCountText ()
{
countText.text = "Счет" + Счет.ToString ();
if (Счет >= 12)
{
winText.text = "Вы выиграли!";
}
}
void Death()
{
if (Healths <= 0)
{
Destroy(gameObject);
}
}
void Update()
{
if (UnderWater == true)
{
Healths -= Time.deltaTime;
}
if (Healths <= 0)
{
Destroy (gameObject);
}
}
}
Проблему решил)