void Counter(int count) { Prefab += count; if (Prefab > Prefabs.Length - 1) { Prefab = 0; } else if (Prefab < 0) { Prefab = Prefabs.Length - 1; } if (Instance != null) { Destroy(Instance); } Instance = Instantiate(Prefabs[Prefab]); particleSystems = Instance.GetComponentsInChildren <ParticleSystem>(); //Get color from current instance svList.Clear(); foreach (var ps in particleSystems) { Color baseColor = ps.main.startColor.color; SVA baseSVA = new SVA(); Color.RGBToHSV(baseColor, out H, out baseSVA.S, out baseSVA.V); baseSVA.A = baseColor.a; svList.Add(baseSVA); } }
void Counter(int count) { Prefab += count; if (Prefab > Prefabs.Length - 1) { Prefab = 0; } else if (Prefab < 0) { Prefab = Prefabs.Length - 1; } if (Instance != null) { Destroy(Instance); } Instance = Instantiate(Prefabs[Prefab]); Instance.SetActive(false); if (activationTime.Length == Prefabs.Length) { CancelInvoke(); if (activationTime[Prefab] > 0.01f) { Invoke("Activate", activationTime[Prefab]); } if (activationTime[Prefab] == 0f) { Instance.SetActive(true); } } particleSystems = Instance.GetComponentsInChildren <ParticleSystem>(); //Get color from current instance svList.Clear(); foreach (var ps in particleSystems) { Color baseColor = ps.main.startColor.color; SVA baseSVA = new SVA(); Color.RGBToHSV(baseColor, out H, out baseSVA.S, out baseSVA.V); baseSVA.A = baseColor.a; svList.Add(baseSVA); } if (useAnimation == true) { //if (Prefab == 1) // animObject.SetTrigger("one"); animObject.SetInteger("toDo", Prefab); } }