void StopPlayer(playerPlataformerController player) { player.StopAllAttack(); player.targetVelocity = Vector2.zero; player.StopInput(); }
// Update is called once per frame void Update() { // Cuida da vida PlayerHealth(); PlayerBar(); // Camera CameraControl(); // BGOs do mapa MapaBGO(); if (Input.GetKeyDown(KeyCode.Escape) && mode16bit) { mode16bit = false; } else if (Input.GetKeyDown(KeyCode.Escape) && !mode16bit) { mode16bit = true; } if (Input.GetKeyDown(KeyCode.JoystickButton8)) { Instantiate(players[3]); } // Pausa o jogo if (Input.GetKeyDown(KeyCode.JoystickButton9) && !isPaused) { isPaused = true; } else if (Input.GetKeyDown(KeyCode.JoystickButton9) && isPaused) { isPaused = false; } if (Input.GetKeyDown(KeyCode.Backspace)) { TDEEffect(rightPlayerScript); } // Pausa o jogo if (isPaused) { Time.timeScale = 0; leftPlayerScript.animator.speed = 0; rightPlayerScript.animator.speed = 0; leftPlayerScript.enableControls = false; rightPlayerScript.enableControls = false; uiTexts[5].enabled = true; } else { uiTexts[5].enabled = false; } if (!hitStopCurrently && !isPaused && !timeFreeze) { Time.timeScale = 1; leftPlayerScript.animator.speed = 1; rightPlayerScript.animator.speed = 1; } // Checa a troca de lados var onTopLeft = leftPlayer.transform.root.GetChild(2).GetChild(4).GetComponent <jumpOverCheck>().onTop; var onTopRight = rightPlayer.transform.root.GetChild(2).GetChild(4).GetComponent <jumpOverCheck>().onTop; if (leftPlayerScript.inCorner || rightPlayerScript.inCorner) { if (leftPlayerScript.posX > rightPlayerScript.posX && flipToggle && !onTopLeft && !onTopRight && !leftPlayerScript.currentlyAttacking && !rightPlayerScript.currentlyAttacking && leftPlayerScript.grounded && rightPlayerScript.grounded) { leftPlayerScript.isLeft = false; rightPlayerScript.isLeft = true; leftPlayerScript.flipCharacterLeft(); rightPlayerScript.flipCharacterRight(); flipToggle = false; } else if (leftPlayerScript.posX < rightPlayerScript.posX && !flipToggle && !onTopLeft && !onTopRight && !leftPlayerScript.currentlyAttacking && !rightPlayerScript.currentlyAttacking && leftPlayerScript.grounded && rightPlayerScript.grounded) { leftPlayerScript.isLeft = true; rightPlayerScript.isLeft = false; leftPlayerScript.flipCharacterRight(); rightPlayerScript.flipCharacterLeft(); flipToggle = true; } } else { if (leftPlayerScript.posX > rightPlayerScript.posX && flipToggle && !onTopLeft && !onTopRight && !leftPlayerScript.currentlyAttacking && !rightPlayerScript.currentlyAttacking) { leftPlayerScript.isLeft = false; rightPlayerScript.isLeft = true; leftPlayerScript.flipCharacterLeft(); rightPlayerScript.flipCharacterRight(); flipToggle = false; } else if (leftPlayerScript.posX < rightPlayerScript.posX && !flipToggle && !onTopLeft && !onTopRight && !leftPlayerScript.currentlyAttacking && !rightPlayerScript.currentlyAttacking) { leftPlayerScript.isLeft = true; rightPlayerScript.isLeft = false; leftPlayerScript.flipCharacterRight(); rightPlayerScript.flipCharacterLeft(); flipToggle = true; } } // Cuida do contador de combo ComboCounter(); // Seleciona as coisas que acontecem quando o jogo roda if (gameRunning && !isPaused) { // Controle leftPlayerScript.enableControls = true; rightPlayerScript.enableControls = true; timeLeft -= Time.deltaTime; if (timeLeft > 0) { uiTexts[10].text = timeLeft.ToString("0"); } else { uiTexts[10].text = 0.ToString("0"); } } else { leftPlayerScript.enableControls = false; rightPlayerScript.enableControls = false; } leftPlayerScript.gameRunning = gameRunning; rightPlayerScript.gameRunning = gameRunning; if (leftPlayerScript.jumpingOver || leftPlayerScript.beingJumpedOver) { leftPlayerScript.enableControls = false; leftPlayerScript.StopInput(); } if (rightPlayerScript.jumpingOver || rightPlayerScript.beingJumpedOver) { rightPlayerScript.enableControls = false; rightPlayerScript.StopInput(); } /*if (!introDone){ * DOTween.To(() => GameObject.FindWithTag("MainCamera").GetComponent<Camera>().orthographicSize, x => GameObject.FindWithTag("MainCamera").GetComponent<Camera>().orthographicSize = x, 10f, 2f); * DOTween.To(() => alpha, x => alpha = x, 1f, 2f); * * uiImages[2].rectTransform.DOScaleX(1, 2).SetDelay(2); * uiImages[5].rectTransform.DOScaleX(1, 2).SetDelay(2); * uiImages[1].rectTransform.DOScaleX(1, 2).SetDelay(2); * uiImages[4].rectTransform.DOScaleX(1, 2).SetDelay(2); * * foreach (var text in uiTexts){ * text.GetComponent<CanvasRenderer>().SetAlpha(alpha); * } * foreach (var images in uiImages){ * images.GetComponent<CanvasRenderer>().SetAlpha(alpha); * } * StartCoroutine(StartCondition()); * }*/ }