private List <Vector3> GetPlacesToConsider() { jengaBlocks = GameObject.Find("Jenga_Blocks_Controller").GetComponent <Jenga_SetUpBlocks>().blockList; jengaTower = new JengaTower(jengaBlocks); List <Vector2> pointsAvailibleForPlacing = GameObject.Find("Jenga_Blocks_Controller").GetComponent <Jenga_Controller>().pointsAvailibleForPlacing; var result = pointsAvailibleForPlacing.Select( x => JengaTowerUtils.FindHighestFreeAtPosition(new Vector3(x.x, 0, x.y))).ToList(); return(result); }
List <List <GameObject> > getLevelGroupedBlocks() { List <List <GameObject> > groupedByLevel = new List <List <GameObject> >(); var jengaTower = new JengaTower(jengaBlocks); bool stop = false; for (int i = 0; !stop; i++) { var elementsOnCurrentLevel = jengaTower.GetBlocksOnLevel(i); if (elementsOnCurrentLevel.Count > 0) { groupedByLevel.Add(elementsOnCurrentLevel); } else { stop = true; } } return(groupedByLevel); }
// Use this for initialization private void Start() { var jengaSetUpBlocks = GameObject.Find("Jenga_Blocks_Controller").GetComponent <Jenga_SetUpBlocks>(); jengaTower = new JengaTower(jengaSetUpBlocks.blockList); }