Ejemplo n.º 1
0
 private void RefreshRounds()
 {
     if (!TurnamentContext.Instance.CurrentGame.IsFinished && TurnamentContext.Instance.CurrentGame.IsStarted)
     {
         roundPanel.Controls.Clear();
         var round   = TurnamentContext.Instance.CurrentGame.ActiveRound;
         var control = new RoundControl(round)
         {
             Dock   = DockStyle.Fill,
             Width  = Width,
             Height = Height
         };
         roundPanel.Controls.Add(control);
     }
 }
Ejemplo n.º 2
0
    public GameObject getDisk(int round)
    {
        if (sceneControler.scoreRecorder.Score >= round * 10)
        {
            if (sceneControler.user.round < 3)
            {
                sceneControler.user.round++;
                sceneControler.user.num            = 0;
                sceneControler.scoreRecorder.Score = 0;
            }
            else
            {
                sceneControler.user.game = 2;
            }
        }
        else
        {
            if (sceneControler.user.num >= 10)
            {
                sceneControler.user.game = 1;
            }
        }
        GameObject   newDisk;
        RoundControl diskOfCurrentRound = new RoundControl(round);

        if (free.Count == 0) // if no free disk, then create a new disk
        {
            newDisk = GameObject.Instantiate(diskPrefab) as GameObject;
            newDisk.AddComponent <ClickGUI>();
            diskData = newDisk.AddComponent <DiskControl>();
        }
        else // else let the first free disk be the newDisk
        {
            newDisk = free[0];
            free.Remove(free[0]);
            newDisk.SetActive(true);
            Debug.Log("get from free");
        }
        diskData       = newDisk.GetComponent <DiskControl>();
        diskData.color = diskOfCurrentRound.color;
        //Debug.Log("free: " + free.Count);

        newDisk.transform.localScale = diskOfCurrentRound.scale * diskPrefab.transform.localScale;
        newDisk.GetComponent <Renderer>().material.color = diskData.color;

        used.Add(newDisk);
        return(newDisk);
    }