void Start() { gameManager = GameObject.Find("GameManager").GetComponent <GameManager>(); _uiManager = GameObject.Find("Canvas").GetComponent <UIManager>(); player = GameObject.FindWithTag("Player").GetComponent <Donkey_Kong>(); //Setando a referência delay tempo = player.tempo; tempoAux = player.tempoAux; for (int i = 0; i < pineapple.Length; i++) { pineapple[i] = indiceVetorPosY - 1; indiceVetorPosY++; } //Definindo as posições em cada um dos vetores //Definindo uma posição e um sentido semi-aleatório para o abacaxi spawnar indiceUpdatePosY = Random.Range(2, 4); auxPos_Y = Random.Range(0, 2); if (auxPos_Y == 0 || indiceUpdatePosY == 4) { auxPos_Y = -1; } transform.position = new Vector3(6.2f, pineapple[indiceUpdatePosY], 0); //posição inicial do abacaxi ao spawnar }
void Start() { for (int i = 0; i < fogo.Length; i++) { fogo[i] = indiceVetorPosY - 1; indiceVetorPosY++; } //Definindo as posições em cada um dos vetores //Setando a referência delay gameManager = GameObject.Find("GameManager").GetComponent <GameManager>(); player = GameObject.FindWithTag("Player").GetComponent <Donkey_Kong>(); _uiManager = GameObject.Find("Canvas").GetComponent <UIManager>(); tempo = (gameManager.tempoRelativo / 60) + 1f; tempoAux = player.tempoAux; if (player.fogoMovInicialAux == true) { tempo = (gameManager.tempoRelativo / 60) + 0.5f; player.fogoMovInicialAux = false; } //Lógica do delay FOGO: se a condição for true, que só será na primeira Instancia e quando reiniciar o round, o delay é reduzido para a movimentação do fogo ficar entre os frames de mov dos abacaxis //Escolhe uma posição aleatória, 4 ou -4, para o fogo instanciado randomINT = Random.Range(1, 3); if (randomINT == 1) { posXFogo = -4.44f; } else { posXFogo = 2.66f; } gameObject.transform.position = new Vector3(posXFogo, 3, 0); }
void Update() { Application.targetFrameRate = 60; if (gameStarted == false) { if (Input.GetKeyDown("space")) { Instantiate(playerStart, new Vector3(0, 0, 0), Quaternion.identity); _uiManager = GameObject.Find("Canvas").GetComponent <UIManager>(); player = GameObject.FindWithTag("Player").GetComponent <Donkey_Kong>(); gameStarted = true; player.erros = 0; _uiManager.score = 0; _uiManager.UpdateMiss(player.erros); } } else { tempoRelativo++; } }