/// <summary> /// Create fading ground wit given position /// </summary> /// <param name="pos"></param> public void CreateFadingGround(Vector3 pos, Color color, bool isHitCenter, Transform parent) { FadingGroundController fgCotrol = GetFadingGround(); fgCotrol.gameObject.SetActive(true); fgCotrol.transform.position = pos; fgCotrol.transform.SetParent(parent); float scale = (isHitCenter) ? groundLargeScale : groundNormalScale; fgCotrol.FadingGround(color, scale, objectFadingTime); }
//Get the inactive fading ground object private FadingGroundController GetFadingGround() { foreach (FadingGroundController o in listFadingGroundControl) { if (!o.gameObject.activeInHierarchy) { return(o); } } FadingGroundController fadingGroundControl = Instantiate(fadingGroundPrefab, Vector3.zero, Quaternion.identity).GetComponent <FadingGroundController>(); listFadingGroundControl.Add(fadingGroundControl); fadingGroundControl.gameObject.SetActive(false); return(fadingGroundControl); }