asset integration 50%
This commit is contained in:
@@ -3,6 +3,7 @@ using System.Collections;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
using UnityEngine.Serialization;
|
||||
using UnityEngine.UI;
|
||||
using DG.Tweening;
|
||||
public class GameCanvas : MonoBehaviour
|
||||
@@ -20,9 +21,11 @@ public class GameCanvas : MonoBehaviour
|
||||
public Image turnTimerSliderTransform;
|
||||
public Color redColor = Color.red;
|
||||
public Color blueColor = Color.blue;
|
||||
public TMP_Text blueTurnTimer;
|
||||
[FormerlySerializedAs("txtTurnTimer")] public TMP_Text redTurnTimer;
|
||||
public TMP_Text txtWhosTurn;
|
||||
public TMP_Text txtTurnTimer;
|
||||
public Image turnTimerRound;
|
||||
public Image blueTurnTimerRound;
|
||||
[FormerlySerializedAs("turnTimerRound")] public Image redTurnTimerRound;
|
||||
|
||||
public GameObject waitingForOpponentPanel;
|
||||
|
||||
@@ -54,8 +57,27 @@ public class GameCanvas : MonoBehaviour
|
||||
}
|
||||
|
||||
turnTimerSliderTransform.transform.localScale = new Vector3(turnTimerFillAmount, 1, 1);
|
||||
txtTurnTimer.text = (GameManager.instance.turnTimer - GameManager.instance.turnTimerCounter).ToString("F0");
|
||||
turnTimerRound.fillAmount = turnTimerFillAmount;
|
||||
string timerString = (GameManager.instance.turnTimer - GameManager.instance.turnTimerCounter).ToString("F0");
|
||||
if (GameManager.instance.SelectedTeam == Team.Red)
|
||||
{
|
||||
if (redTurnTimer != null) redTurnTimer.text = ":"+timerString;
|
||||
if (blueTurnTimer != null) blueTurnTimer.text = string.Empty;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (blueTurnTimer != null) blueTurnTimer.text = ":"+timerString;
|
||||
if (redTurnTimer != null) redTurnTimer.text = string.Empty;
|
||||
}
|
||||
if (GameManager.instance.SelectedTeam == Team.Red)
|
||||
{
|
||||
if (redTurnTimerRound != null) redTurnTimerRound.fillAmount = turnTimerFillAmount;
|
||||
if (blueTurnTimerRound != null) blueTurnTimerRound.fillAmount = 0f;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (blueTurnTimerRound != null) blueTurnTimerRound.fillAmount = turnTimerFillAmount;
|
||||
if (redTurnTimerRound != null) redTurnTimerRound.fillAmount = 0f;
|
||||
}
|
||||
}
|
||||
|
||||
void SwitchTeams(){
|
||||
@@ -63,11 +85,14 @@ public class GameCanvas : MonoBehaviour
|
||||
|
||||
Color newColor = GameManager.instance.SelectedTeam == Team.Red ? redColor : blueColor;
|
||||
turnTimerSliderTransform.DOColor(newColor, 0.5f);
|
||||
|
||||
txtWhosTurn.DOFade(0, 0.25f).OnComplete(() => {
|
||||
txtWhosTurn.text = isMyTurn ? "Your Turn" : "Opponent's Turn";
|
||||
txtWhosTurn.DOFade(1, 0.25f);
|
||||
});
|
||||
|
||||
if (txtWhosTurn != null)
|
||||
{
|
||||
txtWhosTurn.DOFade(0, 0.25f).OnComplete(() => {
|
||||
txtWhosTurn.text = isMyTurn ? "Your Turn" : "Opponent's Turn";
|
||||
txtWhosTurn.DOFade(1, 0.25f);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user