Ahojte,hrám sa s Unity a Csharpom ,som len začiatočník,základy z programovania mám,no chcem sa spýtať na tento kód.
using UnityEngine;
using System.Collections;
public class PlayerController : MonoBehaviour {
private Rigidbody rb;
public float sila;
// Use this for initialization
void Start () {
rb = GetComponent<Rigidbody>();
}
// Update is called once per frame
void FixedUpdate () {
float horizontal = Input.GetAxis("Horizontal");
float vertical = Input.GetAxis("Vertical");
Vector3 move = new Vector3(horizontal,0.0f,vertical);
rb.AddForce(move*sila);
}
void OnTriggerEnter(Collider other)
{
if (other.gameObject.CompareTag("Gem"))
{
other.gameObject.SetActive(false);
}
}
}
A to konkrétne,prečo musí byť jedna premenná public a druhá private.Vďaka