UI Flashcards

1
Q

using TMPro;

private int score;
public TextMeshProUGUI scoreText;

A
void Start()
{
score=0;
scoreText.text = "Score: " + score;
}
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q
void Start()
{
UpdateScore(0);
}
A
public void UpdateScore(int scoreToAdd)
{
score+= scoreToAdd;
scoreText.text = "Score: "+score;
}
IEnumerator SpawnTarget()
{
while (true){ UpdateScore(5);}
}
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

private GameManager gameManager;

A
void Start(){
gameManager=GameObject.Find("Game Manager").GetComponent < GameManager>();
}
private void MouseDown()
{
Destroy(gameObject);
gameManager.UpdateScore(5);
}
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

public TextMeshProUGUI gameOverText;

A

public void GameOver()
{
gameOverText.gameObject.SetActive(true);
}

(No script Target)
private void OnTrigerEnter(Collider other)
{
if (!gameObject.CompareTag("Bad"))
{
gameManager.GameOver();
}
}
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

public bool isGameActive;

A
(GameManager)
(Start)
isGameActive = true;
(public void GameOver())
isGameActive = false;
(IEnumerator SpawnTarget())
while (isGameActive);
(Script Target)
private void OnMouseDown()
{if (gameManager.isGameActive)
{
Todas as funções aqui dentro
}}
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

(Scrip GameManager)

using UnityEngine.SceneManagement;

A

public void RestartGame()
{
SceneManager.LoadScene(SceneManager.GetActiveScene().name);
}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

(script GameManager)
using UnityEngine.UI;

public Button restartButton;

A

public void GameOver()
{
restartButton.gameObject.SetActive(true);
}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

(DifficultyButton)
using UnityEngine.UI

private Button button;
private GameManager gameManager;
public int difficulty;

A

(Start)
button=GetComponent < Button >();
gameManager=GameObject.Find(“Game Manager”).GetComponent < GameManager >();
button.onClick.AddListener(SetDifficulty);

void SetDifficulty()
{
Debug.Log(gameObject.name +”was clicked”);
gameManager.StartGame(difficulty);

}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

(GameManager)

public GameObject titleScreen;

A
void StartGame(int difficulty)
{
.....
spawnRate /= difficulty;
titleScreen.gameObject.SetActive(false);
}
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

using UnityEngine.SceneManagement;

Carregar as cenas do jogo

A

public void StartNew()
{
SceneManager.LoadScene(1);
}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

using UnityEditor;

fazer botão sair do jogo)

A
public void Exit()
{
#if UNITY_EDITOR
EditorApplication.ExitPlaymode();
#else
Application.Quit();
#endif
}
How well did you know this?
1
Not at all
2
3
4
5
Perfectly