Beispiel #1
0
    /// <summary>
    /// Make the elements selectable or not if a player select it
    /// If the local can't be selected, display the next selectable element
    /// </summary>
    /// <param name="_previousType">Previous Type of the player</param>
    /// <param name="_newType">new Type of the player</param>
    public void UpdateOnlineSelection(PlayerType _newType, int _playerID)
    {
        characterSelectionElements.ToList().ForEach(e => e.CharacterSelectionImages.Where(i => i.CharacterType == _newType).ToList().ForEach(i => i.CanBeSelected = false));
        TDS_CharacterSelectionElement _element = characterSelectionElements.Where(e => (e.PlayerInfo != null) && (e.PlayerInfo.PhotonPlayer.ID == _playerID)).FirstOrDefault();

        if (_element)
        {
            _element.DisplayImageOfType(_newType);
        }
        if (!TDS_GameManager.LocalIsReady && !LocalElement.CurrentSelection.CanBeSelected)
        {
            LocalElement.DisplayNextImage();
        }
    }
Beispiel #2
0
    /// <summary>
    /// Add a new player within the CharacterSelectionElements
    /// If the added player is the local player, set the element as the local element
    /// </summary>
    /// <param name="_newPlayer">Id of the added player</param>
    public void AddNewPhotonPlayer(PhotonPlayer _newPlayer, PlayerType _type = PlayerType.Unknown)
    {
        TDS_GameManager.PlayersInfo.Add(new TDS_PlayerInfo(PhotonNetwork.player.ID, null, _newPlayer));
        TDS_CharacterSelectionElement _elem = characterSelectionElements.Where(e => e.PlayerInfo == null).FirstOrDefault();

        if (!_elem)
        {
            return;
        }
        _elem.SetPhotonPlayer(_newPlayer);
        if (_newPlayer.ID == PhotonNetwork.player.ID)
        {
            LocalElement = _elem;
            LocalElement.SetPlayerLocal();
            return;
        }
        if (_type != PlayerType.Unknown)
        {
            _elem.DisplayImageOfType(_type);
        }
    }