-1
私はターンベースのゲームで3回同時に表示しようとしています。 最初にカウントダウンされる合計時間です。 他の2つのタイマーには、各プレーヤーのカウントダウン時間が表示されます。 別のクラスからブール値をチェックして、それがどのターンであるかを調べる(myplayer urn)デルタタイムを停止する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;
}
}