Пример #1
0
    // Use this for initialization
    void Awake()
    {
        p1StartingPosition = p1StartingPositionTransform.position;
        p2StartingPosition = p2StartingPositionTransform.position;
        player1GameObject  = Instantiate(playerPrefab, p1StartingPosition, Quaternion.identity);
        player2GameObject  = Instantiate(playerPrefab, p2StartingPosition, Quaternion.identity);
        player1            = player1GameObject.GetComponent <CharacterControler>();
        player2            = player2GameObject.GetComponent <CharacterControler>();
        P1HealthBar.GetComponentInChildren <HealthBarScript>().character = player1;
        P2HealthBar.GetComponentInChildren <HealthBarScript>().character = player2;
        player1.SetupControl(1, MatchSettings.Instance.p1Color);
        player2.SetupControl(2, MatchSettings.Instance.p2Color);
        player1.facingLeft = false;
        player2.facingLeft = true;
        player1.HandleHorizontalOrientation();
        player2.HandleHorizontalOrientation();

        cameraController.players    = new GameObject[2];
        cameraController.players[0] = player1GameObject;
        cameraController.players[1] = player2GameObject;

        hitFeedP1.character = player1;
        hitFeedP2.character = player2;

        maxRounds = MatchSettings.Instance.MaxRounds;
        roundCounterP1.maxRounds = maxRounds;
        roundCounterP1.Initialize();
        roundCounterP2.maxRounds = maxRounds;
        roundCounterP2.Initialize();

        maxTime = MatchSettings.Instance.TimeLimit;
        time    = maxTime;

        Invoke("SetupNewRound", 0.001f);
    }
Пример #2
0
 private void SetupNewRound()
 {
     //winnerRounds += 1;
     //winnerRoundsText.text = "Rounds won: " + winnerRounds;
     if (roundsP1 >= maxRounds || roundsP2 >= maxRounds)
     {
         StartCoroutine("ReturnToMenu");
         return;
     }
     currentRound++;
     player1.controlable = false;
     player2.controlable = false;
     player1.ResetToNeutral();
     player2.ResetToNeutral();
     player1.transform.position = p1StartingPosition;
     player2.transform.position = p2StartingPosition;
     player1.facingLeft         = false;
     player2.facingLeft         = true;
     player1.HandleHorizontalOrientation();
     player2.HandleHorizontalOrientation();
     time             = maxTime;
     timeCounter.text = "" + time;
     AnnounceNewRound();
 }