------------------------------------ void Update() { if (Input.GetKey("left")) transform.Rotate(0, Time.deltaTime * -90, 0); if (Input.GetKey("right")) transform.Rotate(0, Time.deltaTime * 90, 0); if (Input.GetKey("up")) transform.Rotate(Time.deltaTime * 90, 0, 0); if (Input.GetKey("down")) transform.Rotate(Time.deltaTime * -90, 0, 0); } ------------------------------------ public GameObject PrefabKoule; ------------------------------------ float jakDlouhoNabijim = 0f; ------------------------------------ if (Input.GetKey(KeyCode.Space)) jakDlouhoNabijim += Time.deltaTime; else { if (jakDlouhoNabijim > 0f) // vystrelit: { float SILA = 1000f; Vector3 odkud = transform.position + Vector3.up; // aby nestrelil sam sebe GameObject koule = Instantiate(PrefabKoule, odkud, Quaternion.identity); Rigidbody krb = koule.GetComponent(); krb.AddForce(jakDlouhoNabijim * SILA * this.transform.forward); jakDlouhoNabijim = 0f; // abych nestrilel, dokud zase nenabiju } } ------------------------------------ public TMP_Text TextSilaVystrelu; ------------------------------------ TextSilaVystrelu.text = "Cas: "+123.45.ToString() + "s"; ------------------------------------ public AudioClip zvuk; ------------------------------------ AudioSource.PlayClipAtPoint(zvuk, transform.position); ------------------------------------