viewing paste Unknown #46258 | C#

Posted on the
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI; 
 
public class PlayerController : MonoBehaviour {
 
    public float speed;
    public Text countText;
    public Text winText;
 
    private Rigidbody rb;
    private int count; 
 
    // Use this for initialization
    void Start () {
        rb = GetComponent<Rigidbody> ();
        count = 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); 
                    count = count + 1;
                    SetCountText ();
                }
        }
 
    void SetCountText()
    {
        countText.text = "Count: " + count.ToString ();
        if (count >= 12) {
            winText.text = "You Win Casu;";
        }
    }
}
 
Viewed 1021 times, submitted by Guest.