| | |
| | | } |
| | | } |
| | | |
| | | public BattleEffectPlayer PlayEffect(int ObjID, int effectId, Transform parent) |
| | | public BattleEffectPlayer PlayEffect(int ObjID, int effectId, Transform parent, BattleCamp camp) |
| | | { |
| | | if (effectId <= 0) |
| | | { |
| | | BattleDebug.LogError("effect id <= 0"); |
| | | Debug.LogError("effect id <= 0"); |
| | | return null; |
| | | } |
| | | |
| | | var effectCfg = EffectConfig.Get(effectId); |
| | | if (null == effectCfg) |
| | | { |
| | | BattleDebug.LogError("effect config is null, effectId : " + effectId); |
| | | Debug.LogError("effect config is null, effectId : " + effectId); |
| | | return null; |
| | | } |
| | | |
| | |
| | | effectDict[effectId] = new List<BattleEffectPlayer>(); |
| | | } |
| | | |
| | | BattleDebug.LogError("播放特效 " + effectId); |
| | | |
| | | BattleEffectPlayer effectPlayer = BattleEffectPlayer.Create(effectId, battleField.battleRootNode.transform); |
| | | // 设置特效缩放和方向 |
| | | |
| | | effectPlayer.transform.position = parent.position; |
| | | float effectScale = parent.transform.localScale.x; |
| | | effectPlayer.transform.localScale *= effectScale; |
| | | |
| | | effectPlayer.onDestroy += OnEffectDestroy; |
| | | if (effectPlayer != null) |
| | | { |
| | | effectDict[effectId].Add(effectPlayer); |
| | | } |
| | | effectPlayer.Play(true); |
| | | |
| | | var effectScale = effectPlayer.transform.localScale; |
| | | effectScale.x *= camp == BattleCamp.Red ? 1 : -1; |
| | | effectPlayer.transform.localScale = effectScale; |
| | | |
| | | return effectPlayer; |
| | | } |
| | | |