public void DoFX(FXType fxType, Vector2 fxPosition) { if (pool == null) { pool = ObjectPool.instance; } string animStateName = fxType.ToString(); if (fxType == FXType.Bugs) { if (AreaController.instance.active_area.areaType == AreaType.Interior) { return; } animStateName += Random.Range(0, 2).ToString(); } GameObject fxGobj = pool.GetObjectForType("FX", true, fxPosition); // set animation fxGobj.GetComponentInChildren <Animator>().Play(animStateName); activeFX.Add(fxGobj); }
public void PlayFX(Vector3 position, FXType hitType, string colorText, float duration, float scale = 1) { GameObjectPoolManager.PrefabNames prefabName = (GameObjectPoolManager.PrefabNames)Enum.Parse(typeof(GameObjectPoolManager.PrefabNames), hitType.ToString()); Color color = ClientUtils.HTMLColorToColor(colorText); FX_Base fx = GameObjectPoolManager.Instance.PoolDict[prefabName].AllocateGameObject <FX_Base>(transform); fx.transform.position = position; fx.Play(color, duration, scale); }