Esempio n. 1
0
    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();
    }
Esempio n. 2
0
 private void checkWin(PlayerControlScheme controlScheme)
 {
     if (getPlayerInfo(controlScheme).score >= winCondition)
     {
         controller.showWinText(controlScheme);
         StartCoroutine(backToMainMenu());
     }
 }
Esempio n. 3
0
 public PlayerInfo getPlayerInfo(PlayerControlScheme controlScheme)
 {
     if (controlScheme == PlayerControlScheme.MULTIPLAYER_1 || controlScheme == PlayerControlScheme.SINGLE_PLAYER)
     {
         return(player1Info);
     }
     else
     {
         return(player2Info);
     }
 }
Esempio n. 4
0
    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();
        }
    }
Esempio n. 5
0
 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!";
     }
 }
Esempio n. 6
0
 public void addScore(PlayerControlScheme controlScheme)
 {
     getPlayerInfo(controlScheme).score++;
     updateScoreText();
     StartCoroutine(waitAndCheckWin(controlScheme));
 }
Esempio n. 7
0
    public InputController()
    {
        Controls = new PlayerControlScheme();

        SubscribeFunctions();
    }