-1
차례를 기준으로 한번에 3 번 표시하려고합니다. 첫 번째 시간은 카운트 다운되는 총 시간입니다. 다른 두 개의 타이머는 각 플레이어의 카운트 다운 시간을 보여줍니다. 다른 클래스에서 확인 된 부울 값이 있습니다 (myplayerturn)델타 시간 중지 C#
지금은 총 시간과 플레이어 시간을 모두 효과적으로 표시 할 수 있지만 플레이어 시간이 실행될 때마다 다른 플레이어 타이머를 일시 중지하십시오. }
public class countDown : MonoBehaviour {
public Text timerText;
public Text PlayerTime;
public Text OpponentTime;
public float myTimer = 3600;
// Use this for initialization
void Start() {
timerText = GetComponent<Text>();
PlayerTime = GetComponent<Text>();
OpponentTime = GetComponent<Text>();
}
// Update is called once per frame
void Update() {
if (GetComponent<differentclass>().myplayerturn)
{
//I'm gueussing this is where i need to pause OpponentTime;
// and start PlayerTime
}
else{
// pause PlayerTime
}
int minutes = Mathf.FloorToInt(myTimer/60F);
int seconds = Mathf.FloorToInt(myTimer - minutes * 60);
string rTime = string.Format("{0:00}:{1:00}", minutes, seconds);
myTimer -= Time.deltaTime;
timerText.text = rTime;
PlayerTime.text = rTime;
OpponentTime.text = rTime;
}
을 다음과