| | |
| | | this.gameObject.SetActive(true); |
| | | } |
| | | |
| | | if (effectConfig.autoDestroy != 0) |
| | | { |
| | | GameObject.Destroy(gameObject, effectConfig.destroyDelay); |
| | | } |
| | | |
| | | |
| | | PlayEffect(); |
| | | |
| | | |
| | |
| | | |
| | | |
| | | // 创建后的特效会自动隐藏 需要手动调用Play才能播放 |
| | | public static BattleEffectPlayer Create(int effectId, Transform parent, bool createNewChild = false) |
| | | public static BattleEffectPlayer Create(int effectId, Transform parent) |
| | | { |
| | | // 直接创建特效播放器,不使用对象池 |
| | | BattleEffectPlayer BattleEffectPlayer = null; |
| | | BattleEffectPlayer battleEffectPlayer = null; |
| | | |
| | | if (createNewChild) |
| | | { |
| | | GameObject newGo = new GameObject("BattleEffectPlayer_" + effectId); |
| | | newGo.transform.SetParent(parent, false); |
| | | BattleEffectPlayer = newGo.AddComponent<BattleEffectPlayer>(); |
| | | } |
| | | else |
| | | { |
| | | BattleEffectPlayer = parent.AddMissingComponent<BattleEffectPlayer>(); |
| | | } |
| | | |
| | | BattleEffectPlayer.effectId = effectId; |
| | | BattleEffectPlayer.SetActive(true); |
| | | return BattleEffectPlayer; |
| | | GameObject newGo = new GameObject("BattleEffectPlayer_" + effectId); |
| | | newGo.transform.SetParent(parent, false); |
| | | newGo.AddMissingComponent<RectTransform>(); |
| | | battleEffectPlayer = newGo.AddComponent<BattleEffectPlayer>(); |
| | | |
| | | battleEffectPlayer.effectId = effectId; |
| | | battleEffectPlayer.SetActive(true); |
| | | return battleEffectPlayer; |
| | | } |
| | | |
| | | /// <summary> |