private void destroyChildren(Transform locator) { MahjongTile tile = null; while (locator.childCount > 0) { tile = locator.GetChild(0).GetComponent <MahjongTile> (); tile.Despawn(); } }
//random play one tile from network command public virtual bool Play(TileDef def) { MahjongTile tile = null; if (((Player)_proxy).Play(def)) { for (int i = 0; i < _sortPocketList.Count; ++i) { if (_sortPocketList [i].Def.Value == def.Value) { _playIndex = i; tile = _sortPocketList [_playIndex]; _sortPocketList.Remove(tile); placePlayed(tile); return(true); } } Debug.Log(_sortPocketList.Count); Debug.Log(Proxy.Index + " Play(TileDef def)####################" + _playIndex); tile = MahjongTile.Create(def); placePlayed(tile); _playIndex = Random.Range(0, _sortPocketList.Count); tile = _sortPocketList [_playIndex]; _sortPocketList.Remove(tile); tile.Despawn(); } else { _proxy.RemovePocketList(1); tile = MahjongTile.Create(def); placePlayed(tile); _playIndex = Random.Range(0, _sortPocketList.Count); tile = _sortPocketList [_playIndex]; _sortPocketList.Remove(tile); tile.Despawn(); } return(false); }