public static void RePlayMatchingSpeed(GameObject _target, float _duraiton, float _delayTime = 0) { if (_duraiton == 0) { return; } NsEffectManager.RunReplayEffect(_target, true); FXRoot fr = _target.GetComponent <FXRoot>(); if (fr != null) { if (_delayTime > 0 || _duraiton != fr.length) { fr.Play(_delayTime, fr.length / _duraiton); } else { fr.Play(); } } else { Debug.Log(_target.name + "找不到FXRoot组件!"); } }
private void CreateAttachPrefab(Vector3 position, float size) { if (this.m_AttachPrefab == null) { return; } GameObject gameObject = base.CreateGameObject(this.m_AttachPrefab, this.m_AttachPrefab.transform.position + position, this.m_AttachPrefab.transform.rotation); if (gameObject == null) { return; } base.ChangeParent(NcEffectBehaviour.GetRootInstanceEffect().transform, gameObject.transform, false, null); NcTransformTool.CopyLossyToLocalScale(gameObject.transform.lossyScale * size, gameObject.transform); NsEffectManager.AdjustSpeedRuntime(gameObject, this.m_fPrefabSpeed); if (0f < this.m_fPrefabLifeTime) { NcAutoDestruct ncAutoDestruct = gameObject.GetComponent <NcAutoDestruct>(); if (ncAutoDestruct == null) { ncAutoDestruct = gameObject.AddComponent <NcAutoDestruct>(); } ncAutoDestruct.m_fLifeTime = this.m_fPrefabLifeTime; } }
/// <summary> /// 物品小于10的时候放到特效里面 /// </summary> void CreateItemLessThan10() { HideUipel(); if (fxAfterOpen != null) { NsEffectManager.RunReplayEffect(fxAfterOpen, true); } coinGo.SetActive(true); ReleaseGrid(); List <int> idList = GameCenter.treasureHouseMng.idList; for (int i = 0, max = items.Count; i < max; i++) { if (idList.Count > i) { items[i].SetActive(true); ItemUI itemUI = ItemUI.CreatNew(items[i].transform, Vector3.zero, Vector3.one); if (itemUI != null) { itemUI.FillInfo(new EquipmentInfo(idList[i], 1, EquipmentBelongTo.PREVIEW)); } } else { items[i].SetActive(false); } } }
void ShowFxAfterOpen() { if (fxAfterOpen != null) { NsEffectManager.RunReplayEffect(fxAfterOpen, true); } }
// Function -------------------------------------------------------------------- // Loop Function -------------------------------------------------------------------- // Control Function ----------------------------------------------------------------- // Event Function ------------------------------------------------------------------- public override void OnUpdateEffectSpeed(float fSpeedRate, bool bRuntime) { if (bRuntime) { NsEffectManager.AdjustSpeedRuntime(m_LinkGameObject, fSpeedRate); } }
public override void OnSetActiveRecursively(bool bActive) { if (m_LinkGameObject != null) { NsEffectManager.SetActiveRecursively(m_LinkGameObject, bActive); } }
private void CreateEffect() { if (this.m_EffectPrefabs[this.m_nIndex] == null) { return; } if (this.m_EffectGUIText != null) { this.m_EffectGUIText.text = this.m_EffectPrefabs[this.m_nIndex].name; } float num = 0f; if (1 < this.m_nCreateCount) { num = this.m_fRandomRange; } for (int i = 0; i < this.GetInstanceRoot().transform.childCount; i++) { UnityEngine.Object.Destroy(this.GetInstanceRoot().transform.GetChild(i).gameObject); } for (int j = 0; j < this.m_nCreateCount; j++) { GameObject gameObject = (GameObject)UnityEngine.Object.Instantiate(this.m_EffectPrefabs[this.m_nIndex], new Vector3(UnityEngine.Random.Range(-num, num), 0f, UnityEngine.Random.Range(-num, num)), Quaternion.identity); gameObject.transform.localScale = gameObject.transform.localScale * this.m_fCreateScale; NsEffectManager.PreloadResource(gameObject); gameObject.transform.parent = this.GetInstanceRoot().transform; FxmTestSingleMain.SetActiveRecursively(gameObject, true); } }
public static Transform SpawnEffect(string prefabName, Vector3 posAndRot, Quaternion spawnRot, float speed = 1) { // Debug.LogError("2JW : G_GameInfo.SpawnEffect() In - " + prefabName); if (!PoolManager.Pools["Effect"].prefabs.ContainsKey(prefabName)) { CreateNewEffectPoolItem(prefabName, () => { SpawnEffect(prefabName, posAndRot, spawnRot, speed); }); return(null); } Transform spawned; if (posAndRot != Vector3.zero) { spawned = PoolManager.Pools["Effect"].Spawn(prefabName, posAndRot, spawnRot); } else { spawned = PoolManager.Pools["Effect"].Spawn(prefabName); } // 최대 이펙트 스피드는 0.5f배로. 4배이상은 안나오는게 많음. speed = Mathf.Clamp(speed, 0.5f, 4f); NsEffectManager.AdjustSpeedRuntime(spawned.gameObject, speed); return(spawned); }
// Control Function ----------------------------------------------------------------- void CreateAttachPrefab(Vector3 position, float size) { if (m_AttachPrefab == null) { return; } GameObject createGameObject = (GameObject)CreateGameObject(m_AttachPrefab, m_AttachPrefab.transform.position + position, m_AttachPrefab.transform.rotation); if (createGameObject == null) { return; } // Change Parent ChangeParent(GetRootInstanceEffect().transform, createGameObject.transform, false, null); NcTransformTool.CopyLossyToLocalScale(createGameObject.transform.lossyScale * size, createGameObject.transform); // PrefabAdjustSpeed NsEffectManager.AdjustSpeedRuntime(createGameObject, m_fPrefabSpeed); // m_fPrefabLifeTime if (0 < m_fPrefabLifeTime) { NcAutoDestruct ncAd = createGameObject.GetComponent <NcAutoDestruct>(); if (ncAd == null) { ncAd = createGameObject.AddComponent <NcAutoDestruct>(); } ncAd.m_fLifeTime = m_fPrefabLifeTime; } }
void CreateEffect() { if (m_EffectPrefabs[m_nIndex] == null) { return; } if (m_EffectGUIText != null) { m_EffectGUIText.text = m_EffectPrefabs[m_nIndex].name; } float fRandomRange = 0; if (1 < m_nCreateCount) { fRandomRange = m_fRandomRange; } for (int n = 0; n < GetInstanceRoot().transform.childCount; n++) { Destroy(GetInstanceRoot().transform.GetChild(n).gameObject); } for (int n = 0; n < m_nCreateCount; n++) { GameObject createObj = (GameObject)Instantiate(m_EffectPrefabs[m_nIndex], new Vector3(Random.Range(-fRandomRange, fRandomRange), 0, Random.Range(-fRandomRange, fRandomRange)), Quaternion.identity); createObj.transform.localScale = createObj.transform.localScale * m_fCreateScale; NsEffectManager.PreloadResource(createObj); createObj.transform.parent = GetInstanceRoot().transform; #if (UNITY_4_0 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_4 || UNITY_4_5 || UNITY_4_6 || UNITY_4_7 || UNITY_4_8 || UNITY_4_9) SetActiveRecursively(createObj, true); #endif } }
/// 이펙트 폴더에 존재하는 프리팹을 스폰시켜준다. public static Transform SpawnEffect(string prefabName, float speed = 1f, Transform posAndRot = null, Transform parent = null, Vector3 scale = default(Vector3), System.Action <Transform> call = null) { if (_GameInfo == null || _GameInfo.effectPool == null) { if (TempOriEffectsDic.ContainsKey(prefabName)) //AssetbundleLoader.GetEffect(prefabName, (trn) => { //< 인게임이 아닌곳에서 호출한것이기때문에 생성해서 붙여주고 리턴해줌 //GameObject obj = TaskManager.Instantiate(trn) as GameObject; GameObject obj = TaskManager.Instantiate(TempOriEffectsDic[prefabName]) as GameObject; if (parent != null) { obj.transform.parent = parent; } if (posAndRot != null) { obj.transform.position = posAndRot.transform.position; obj.transform.rotation = posAndRot.transform.rotation; } if (call != null) { call(obj.transform); } }//, false); return(null); } if (!PoolManager.Pools["Effect"].prefabs.ContainsKey(prefabName)) { CreateNewEffectPoolItem(prefabName, () => { SpawnEffect(prefabName, speed, posAndRot, parent, scale, call); }); return(null); } Transform spawned; if (null != posAndRot) { spawned = PoolManager.Pools["Effect"].Spawn(prefabName, posAndRot.position, posAndRot.rotation, parent); } else { spawned = PoolManager.Pools["Effect"].Spawn(prefabName, parent); } spawned.localScale = scale; // 최대 이펙트 스피드는 0.5f배로. 4배이상은 안나오는게 많음. speed = Mathf.Clamp(speed, 0.5f, 4f); NsEffectManager.AdjustSpeedRuntime(spawned.gameObject, speed); if (call != null) { call(spawned); } return(spawned); }
bool CreateCurrentInstanceEffect(GameObject gameObj) { NgUtil.LogDevelop("CreateCurrentInstanceEffect() - gameObj - " + gameObj); GameObject parentObj = GetInstanceRoot(); // 이전거 삭제 NgObject.RemoveAllChildObject(parentObj, true); // 새로 생성 if (gameObj != null) { GameObject createObj = (GameObject)Instantiate(gameObj); NsEffectManager.PreloadResource(createObj); createObj.transform.parent = parentObj.transform; m_InstanceEffectObject = createObj; #if (UNITY_4_0 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_4 || UNITY_4_5 || UNITY_4_6 || UNITY_4_7 || UNITY_4_8 || UNITY_4_9) NgObject.SetActiveRecursively(createObj, true); #endif m_FXMakerControls.SetStartTime(); return(true); } m_InstanceEffectObject = null; return(false); }
void RunReplayEffect(bool bClearOldParticle) { if (m_ReplayObject != null) { // Run Replay NsEffectManager.RunReplayEffect(m_ReplayObject, bClearOldParticle); } }
void ShowItem() { if (fxAfterOpen != null) { NsEffectManager.RunReplayEffect(fxAfterOpen, true); switch (infoList.Count) { case 1: fxAfterOpen.transform.localPosition = new Vector3(156, 30, 0); break; case 2: fxAfterOpen.transform.localPosition = new Vector3(124, 30, 0); break; case 3: fxAfterOpen.transform.localPosition = new Vector3(75, 30, 0); break; case 4: fxAfterOpen.transform.localPosition = new Vector3(55, 30, 0); break; case 5: fxAfterOpen.transform.localPosition = new Vector3(0, 30, 0); break; default: fxAfterOpen.transform.localPosition = new Vector3(0, 56, 0); break; } } if (okBtn != null) { okBtn.gameObject.SetActive(true); } if (nameLabel != null) { nameLabel.gameObject.SetActive(true); } for (int i = 0, max = items.Count; i < max; i++) { if (infoList.Count > i) { items[i].SetActive(true); ItemUI itemUI = ItemUI.CreatNew(items[i].transform, Vector3.zero, Vector3.one * 0.5f); if (itemUI != null) { itemUI.FillInfo(infoList[i]); } } else { items[i].SetActive(false); } } }
public override void OnUpdateEffectSpeed(float fSpeedRate, bool bRuntime) { m_fDuplicateTime /= fSpeedRate; m_fDuplicateLifeTime /= fSpeedRate; if (bRuntime && m_ClonObject != null) { NsEffectManager.AdjustSpeedRuntime(m_ClonObject, fSpeedRate); } }
private void CreateEffect() { if (this.m_TargetPrefab == null) { return; } this.m_InstanceObj = NsEffectManager.CreateReplayEffect(this.m_TargetPrefab); NsEffectManager.PreloadResource(this.m_InstanceObj); }
public static void AdjustSpeedRuntime(GameObject _target, float _fSpeedRate) { NsEffectManager.AdjustSpeedRuntime(_target, _fSpeedRate); FXRoot fr = _target.GetComponent <FXRoot>(); if (fr != null) { fr.Speed = _fSpeedRate; } }
void CreateEffect() { if (m_TargetPrefab == null) { return; } // Create from prefab. m_InstanceObj = NsEffectManager.CreateReplayEffect(m_TargetPrefab); NsEffectManager.PreloadResource(m_InstanceObj); }
public static Component GetComponentInChildren(GameObject tarObj, Type findType) { if (tarObj == null) { return(null); } return(NsEffectManager.GetComponentInChildren(tarObj, findType, new List <GameObject> { tarObj })); }
public static void RunReplayEffect(GameObject instanceObj, bool bClearOldParticle) { NsEffectManager.SetActiveRecursively(instanceObj, true); NcEffectBehaviour[] componentsInChildren = instanceObj.GetComponentsInChildren <NcEffectBehaviour>(true); NcEffectBehaviour[] array = componentsInChildren; for (int i = 0; i < array.Length; i++) { NcEffectBehaviour ncEffectBehaviour = array[i]; ncEffectBehaviour.OnResetReplayStage(bClearOldParticle); } }
public static Texture[] PreloadResource(GameObject tarObj) { if (tarObj == null) { return(new Texture[0]); } return(NsEffectManager.PreloadResource(tarObj, new List <GameObject> { tarObj })); }
void OnEnable() { if (first) { return; } if (supportReplay) { NsEffectManager.RunReplayEffect(gameObject, true); } }
public static void SetReplayEffect(GameObject instanceObj) { NsEffectManager.PreloadResource(instanceObj); NsEffectManager.SetActiveRecursively(instanceObj, false); NcEffectBehaviour[] componentsInChildren = instanceObj.GetComponentsInChildren <NcEffectBehaviour>(true); NcEffectBehaviour[] array = componentsInChildren; for (int i = 0; i < array.Length; i++) { NcEffectBehaviour ncEffectBehaviour = array[i]; ncEffectBehaviour.OnSetReplayState(); } }
public static void Stop(GameObject _target) { NsEffectManager.SetReplayEffect(_target); FXRoot fr = _target.GetComponent <FXRoot>(); if (fr != null) { fr.Stop(); } else { Debug.Log(_target.name + "找不到FXRoot组件!"); } }
public override void OnSetActiveRecursively(bool bActive) { if (m_CreateGameObjects == null) { return; } for (int n = 0; n < m_CreateGameObjects.Length; n++) { if (m_CreateGameObjects[n] != null) { NsEffectManager.SetActiveRecursively(m_CreateGameObjects[n], bActive); } } }
public static void SetActiveRecursively(GameObject target, bool bActive) { int num = target.transform.childCount - 1; while (0 <= num) { if (num < target.transform.childCount) { NsEffectManager.SetActiveRecursively(target.transform.GetChild(num).gameObject, bActive); } num--; } target.SetActive(bActive); }
public override void OnSetActiveRecursively(bool bActive) { if (this.m_CreateGameObjects == null) { return; } for (int i = 0; i < this.m_CreateGameObjects.Length; i++) { if (this.m_CreateGameObjects[i] != null) { NsEffectManager.SetActiveRecursively(this.m_CreateGameObjects[i], bActive); } } }
public static GameObject CreateReplayEffect(GameObject tarPrefab) { if (tarPrefab == null) { return(null); } if (!NcEffectBehaviour.IsSafe()) { return(null); } GameObject gameObject = (GameObject)UnityEngine.Object.Instantiate(tarPrefab); NsEffectManager.SetReplayEffect(gameObject); return(gameObject); }
bool CheckNotSupportComponent(GameObject targetObj, System.Type comType) { FxmInfoIndexing infoIndexingCom = null; Component findCom; string comName = ""; findCom = NsEffectManager.GetComponentInChildren(targetObj, comType); if (findCom != null) { string subString = "UnityEngine."; comName = findCom.ToString(); if (comName.Contains(subString)) { comName = comName.Replace(subString, ""); } infoIndexingCom = findCom.GetComponent <FxmInfoIndexing>(); } if (findCom is ParticleEmitter) { if (IsParticleEmitterOneShot(findCom as ParticleEmitter)) { if (infoIndexingCom != null) { NcParticleSystem ncParticleSystem = infoIndexingCom.m_OriginalTrans.GetComponent <NcParticleSystem>(); FXMakerHierarchy.inst.SetActiveComponent(infoIndexingCom.m_OriginalTrans.gameObject, ncParticleSystem, true); if (ncParticleSystem == null) { FxmPopupManager.inst.ShowWarningMessage("- Replay Error!!! : Used the ParticleEmitter.OneShot." + comName + ".\nYou must change this to NcParticleSystem.bBurst. First, add NcParticleSystem.", 5); } else { FxmPopupManager.inst.ShowWarningMessage("- Replay Error!!! : Used the ParticleEmitter.OneShot." + comName + ".\nYou must change this to NcParticleSystem.bBurst. Please click button(Inspector - 'Convert: OneShot To FXMakerBurst')", 5); } } } } else if (findCom != null) { FxmPopupManager.inst.ShowToolMessage(" - Replay Error!!! : " + comName + " is included.\nThis component does not support the replay.", 5); return(false); } return(true); }
/// <summary> /// PoolManager에 존재하는 객체를 찾아서 Spawn해준다. 존재하지 않는다면, Pool에 등록후 Spawn해준다. /// </summary> public Transform Spawn(string poolName, Transform prefabTrans, Vector3 spawnPos, Quaternion spawnRot, Transform parent, Vector3 scale, float speed = 1f) { SpawnPool spawnPool = null; if (!PoolManager.Pools.TryGetValue(poolName, out spawnPool)) { return(null); } Transform spawned = spawnPool.Spawn(prefabTrans, spawnPos, spawnRot, parent); spawned.localScale = scale; //// for FxMaker : 최대 이펙트 스피드는 0.5f배로. 4배이상은 안나오는게 많음. NsEffectManager.AdjustSpeedRuntime(spawned.gameObject, Mathf.Clamp(speed, 0.5f, 4f)); return(spawned); }