public void playAnimation(PlayerControlScheme controlScheme) { RectTransform rect = GetComponent <RectTransform> (); transform.SetParent(animatorTransform); rect.anchoredPosition = Vector3.zero; gameObject.SetActive(true); transform.SetParent(parentTransform); line = gameObject.GetComponent <LineRenderer>(); line.positionCount = (segments + 1); line.useWorldSpace = false; collider = GetComponent <CircleCollider2D> (); playAnim = true; radius = 100; maxRadius = Mathf.Max(GameManagers.consts.gameSize.x, GameManagers.consts.gameSize.y) * 3; collider.radius = radius; if (controlScheme == PlayerControlScheme.MULTIPLAYER_1 || controlScheme == PlayerControlScheme.SINGLE_PLAYER) { yDirection = 1; } else { yDirection = -1; } particles.Clear(); particles.Play(); }
private void checkWin(PlayerControlScheme controlScheme) { if (getPlayerInfo(controlScheme).score >= winCondition) { controller.showWinText(controlScheme); StartCoroutine(backToMainMenu()); } }
public PlayerInfo getPlayerInfo(PlayerControlScheme controlScheme) { if (controlScheme == PlayerControlScheme.MULTIPLAYER_1 || controlScheme == PlayerControlScheme.SINGLE_PLAYER) { return(player1Info); } else { return(player2Info); } }
private IEnumerator waitAndCheckWin(PlayerControlScheme controlScheme) { hasWonRound = true; //TODO: Play cheering sound effect checkWin(controlScheme); yield return(new WaitForSeconds(1f)); if (getPlayerInfo(controlScheme).score < winCondition) { resetRound(); } }
public void showWinText(PlayerControlScheme controlScheme) { Time.timeScale = 1.0f; player1WinText.gameObject.SetActive(true); player2WinText.gameObject.SetActive(true); if (controlScheme == PlayerControlScheme.MULTIPLAYER_1 || controlScheme == PlayerControlScheme.SINGLE_PLAYER) { player1WinText.text = "WIN!"; player2WinText.text = "LOSE"; } else { player1WinText.text = "LOSE"; player2WinText.text = "WIN!"; } }
public void addScore(PlayerControlScheme controlScheme) { getPlayerInfo(controlScheme).score++; updateScoreText(); StartCoroutine(waitAndCheckWin(controlScheme)); }
public InputController() { Controls = new PlayerControlScheme(); SubscribeFunctions(); }