Exemplo n.º 1
0
 void Start()
 {
     if (_instance == null)
     {
         _instance = this;
         DontDestroyOnLoad(this.gameObject);
     }
     else
     {
         Destroy(_instance.gameObject);
         _instance = this;
         DontDestroyOnLoad(this.gameObject);
     }
 }
Exemplo n.º 2
0
    public void PopulatePlayerPicker(List <Player> players, int requiredPlayers)
    {
        PlayerPicker pickerHandler = new PlayerPicker(requiredPlayers, playerPickerConfirmButton);

        // Clear picker container
        playerPickerContainer.DestroyChildren();

        // Populate picker container
        foreach (Player p in players)
        {
            PlayerPickerView ppv = Instantiate(playerPickerPrefab, playerPickerContainer, false);
            ppv.SetData(p);
            pickerHandler.AddPlayerPickerView(ppv);
        }

        pickerHandler.OnComplete += ConfirmPlayerPicker;
    }