public void RemovePlantTest1() { string name = "Erika's plant"; GameObject newPlant = pmanager.MakePlant(name, "Jade"); int count = pmanager.plantCollection.Count; pmanager.RemovePlant(newPlant); Assert.AreEqual(pmanager.plantCollection.Count, count - 1, String.Format("Plant was removed collection is still the same length")); }
//to remove from collection public void deleteFromList() { string plantName = pManager.plantCollection[indexNum].name; //destory and reset currplant DestroyImmediate(currPlant); currPlant = null; pManager.RemovePlant(indexNum); //remove from collection indexNum = NumOp.Cutoff(indexNum, 0, pManager.plantCollection.Count - 1); //set new index pManager.gameObject.GetComponent <PopUpManager>().PopUpMessage(String.Format("'{0}' has been deleted.", plantName)); prevIndexNum = indexNum; }