using UnityEngine;
using System.Collections;
public class PlayerControl : MonoBehaviour
{
public float speed;
public GUIText countText;
public GUIText winText;
private int count;
void start ()
{
count = 0;
gameObject.audio.enabled = true;
SetCountText ();
winText.text = ("");
}
void Update ()
{
float moveHorizontal = Input.GetAxis ("Horizontal");
float moveVertical = Input.GetAxis("Vertical");
Vector3 movement = new Vector3 (moveHorizontal, 0.0f, moveVertical);
rigidbody.AddForce (movement * speed * Time.deltaTime);
}
ulong BlipSound {
get;
set;
}
void OnTriggerEnter(Collider other)
{
if(other.gameObject.tag == "Pick up")
{
other.gameObject.SetActive(false);
other.gameObject.audio.Play(BlipSound);
count = count + 1;
SetCountText ();
}
}
void SetCountText ()
{
countText.text = "Count: " + count.ToString ();
if(count >= 10)
{
winText.text = "YOU WIN!";
}
}}