//Pick and random block to ignite //Show the player its going to ignite //Next click light the current one on fire public void GenerateSpreadMarkers() { //Debug.Log("Generating stuff"); //Loop through with how many towers there are for (int i = 0; i < LevelManager.instance.infernoTowers.Count + 1; i++) { //only try to place 10 times until it gives up trying to place a block for (int x = 0; x < 10; x++) { //Pick a random block Block randomAdjacent = GetGeneratedFromList(adjacentBlocks); //if there is not already a marker on this spot //and if there is no blocker on the block if (!MarkersContains(randomAdjacent) && !randomAdjacent.blockerOnBlock) { //Create the visual GameObject marker = Instantiate(adjacentPrefab, transform); //Move the visual to the position marker.transform.position = randomAdjacent.transform.position + Vector3.up * 0.1f; //Create the info for the marker SpreadMarker spreadMarker = new SpreadMarker(randomAdjacent, marker); //Add the marker to the list of markers spreadMarkers.Add(spreadMarker); break; } } } }
public bool MarkersContains(SpreadMarker markerToCheck) { for (int i = 0; i < spreadMarkers.Count; i++) { if (spreadMarkers[i].attachedBlock == markerToCheck.attachedBlock) { return(true); } } return(false); }