Exemplo n.º 1
0
 public void Scored(bool team1)
 {
     if (!scored)
     {
         Debug.Log("Scored");
         goalText.Reset();
         scored = true;
         if (team1)
         {
             score1++;
             score1Text.text = score1.ToString();
         }
         else
         {
             score2++;
             score2Text.text = score2.ToString();
         }
         int side = team1 ? 1 : 2;
         Goal(side);
         countTime = false;
         if (overTime)
         {
             Invoke("EndGame", goalDelay);
         }
         else
         {
             StartCoroutine("SetPuck", goalDelay);
         }
     }
 }
Exemplo n.º 2
0
 private void EndGame()
 {
     if (score1 == score2)
     {
         OverTime();
     }
     else
     {
         endText.Reset();
         foreach (TeamController team in teamControllers)
         {
             team.SetPositions();
         }
         //Invoke("SwapSides", 2f);
         if (currentPeriod % 2 == 0)
         {
             Debug.Log("SWPA");
             SwapSides();
         }
         foreach (TeamController team in teamControllers)
         {
             team.SetPositions();
         }
         FindObjectOfType <TitleController>().TitleScreen();
     }
 }
Exemplo n.º 3
0
    private void OverTime()
    {
        overTime = true;
        overTimeText.Reset();
        periodText.text = "OT";

        StartCoroutine("SetPuck", 2f);
    }
Exemplo n.º 4
0
 private void Begin()
 {
     Debug.Log("Begin");
     foreach (TeamController team in teamControllers)
     {
         team.ActivatePlayers();
     }
     goText.Reset();
     countTime = true;
 }
Exemplo n.º 5
0
    private IEnumerator SetPuck(float delay)
    {
        yield return(new WaitForSeconds(delay));

        Debug.Log("SetPuck");
        scored = false;
        puck.transform.position = Vector3.zero;
        puck.GetComponent <Rigidbody2D>().velocity = Vector2.zero;
        foreach (TeamController team in teamControllers)
        {
            team.SetPositions();
        }
        readyText.Reset();
        Invoke("Begin", startDelay);
    }
Exemplo n.º 6
0
 private void EndPeriod()
 {
     timeText.Reset();
     countTime = false;
     scored    = true;
     SetPeriodTime(periodTime);
     currentPeriod++;
     if (currentPeriod > PeriodAmount)
     {
         Invoke("EndGame", 2.1f);
     }
     else
     {
         Invoke("IncrementPeriod", 2f);
         StartCoroutine("SetPuck", 2f);
     }
     Invoke("SwapSides", 2f);
 }
Exemplo n.º 7
0
 public void Out()
 {
     outText.Reset();
     countTime = false;
     StartCoroutine("SetPuck", goalDelay);
 }