warr11r писал(а):Скрипт спидометра выглядит подобным образом:
- Код: Выделить всё
using System;
using System.Collections.Generic;
using UnityEngine;
public class Speedometer : MonoBehaviour{
public GUISkin guiskin;
public GameObject Car;
public float CurrentSpeed {
get { return Car.rigidbody.velocity.magnitude * 3.6f; }
}
void OnGUI() {
if (guiskin != null) GUI.skin = guiskin;
GUILayout.BeginArea(new Rect(Screen.width - 350, Screen.height - 165, 440, 75));
GUILayout.Label((int)CurrentSpeed + " km/h");
GUILayout.EndArea();
return;
}
}
Кидаете на переменную ГО, скорость которой хотите измерять.
Меряете в флоат, игроку показываете целое.
Пасиб но мне после АС на Жабу ближе =)