//duplicate a list of particle systems. Useful for when bounces is higher then 0 void CreateNewPSList(PSList.PSLIST_TYPE psListType) { string[] psListTypeNames = System.Enum.GetNames(typeof(PSList.PSLIST_TYPE)); for (int i = 0; i < psListTypeNames.Length; i++) { if (psListTypeNames[i] == psListType.ToString()) { for (int j = 0; j < psList.Count; j++) { if (psList[j]._psType == psListType) { GameObject newParent = Instantiate(psList[j]._parent) as GameObject; newParent.transform.SetParent(psList[j]._parent.transform.parent); PSList newPSList = new PSList() { _parent = newParent }; newPSList._psType = psListType; newPSList.AddPSToList(newPSList._parent, true); newPSList.EnablePS(); psList.Add(newPSList); if (newParent.transform.Find("Collider") == true) { var boxCo = newParent.transform.Find("Collider").GetComponent <BoxCollider> (); collidersList.Add(boxCo); } return; } } } } }
List <PSList> GetByType(PSList.PSLIST_TYPE type) { List <PSList> types = new List <PSList> (); for (int i = 0; i < psList.Count; i++) { if (psList [i]._psType == type) { types.Add(psList [i]); } } return(types); }
public void RemoveLastByType(PSList.PSLIST_TYPE type) { for (int i = psList.Count - 1; i > 0; i--) { if (psList [i]._psType == type) { psList [i].DisablePS(false); GameObject newObj = psList[i]._parent; psList.RemoveAt(i); if (type == PSList.PSLIST_TYPE.end) { if (newObj.transform.Find("Collider") == true) { RemoveLastCollider(false); } } Destroy(newObj); return; } } }