using UnityEngine;
using System.Collections;
public class PlayerControll : MonoBehaviour {
public float speed;
// Use this for initialization
void Start (){
count=0;
CountText();
}
// Update is called once per frame
void Update () {
}
void FixedUpdate () {
Vector3 movement = new Vector3(moveHorizontal,0.0f,moveVertical);
rigidbody.AddForce(movement * speed * Time.deltaTime);
float moveHorizontal = Input.GetAxis("Horizontal");
float moveVertical = Input.GetAxis("Vertical");
}
}
private int count;
public GUIText countText;
void OnTriggerEnter(Collider other){
if (other.gameObject.tag == item)
{other.gameObject.SetActive(false);
count=count+1;
CountText();}
}
void CountText(){
countText.text="Count: " + count.ToString();
}
↧