// Click handler public void ClickHandler() { // toggle the type of cell in the block through the bacTypes currentType++; if (bacTypes.Length <= currentType) { currentType = 0; } // Load the type // export the array // Get rid of the last spawned item if (LastSpawned) { DestroyImmediate(LastSpawned); } LastSpawned = Instantiate(bacTypes [currentType]) as GameObject; if (LastSpawned) { currentBacteria = LastSpawned.GetComponent <Bacteria> (); // add the row/col to the bacteria data currentBacteria.row = (int)row; currentBacteria.col = (int)col; // Add the bacteria to the quorum qc.AddBacteria(currentBacteria); } // Set the values in the display SetValues(); }
public void Start() { // get the quorum controller qc = FindObjectOfType <QuorumController>(); // Load the type GameObject gm = bacTypes [currentType]; if (gm) { currentBacteria = gm.GetComponent <Bacteria> (); } // add the row/col to the bacteria data currentBacteria.row = row; currentBacteria.col = col; // Set the values in the display SetValues(); // Add the bacteria to the quorum qc.AddBacteria(currentBacteria); }