| | |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | public bool isRedCamp = true; |
| | | public EffectConfig effectConfig; |
| | | |
| | | public float speedRate = 1f; |
| | |
| | | |
| | | if (effectConfig.effectPos != null && effectConfig.effectPos.Length >= 2) |
| | | { |
| | | rectTrans.anchoredPosition += new Vector2(effectConfig.effectPos[0], effectConfig.effectPos[1]); |
| | | rectTrans.anchoredPosition += new Vector2((isRedCamp ? 1f : -1f) * effectConfig.effectPos[0], effectConfig.effectPos[1]); |
| | | } |
| | | |
| | | if (effectConfig.effectScale > 0f) |
| | |
| | | |
| | | |
| | | // 创建后的特效会自动隐藏 需要手动调用Play才能播放 |
| | | public static BattleEffectPlayer Create(int effectId, Transform parent) |
| | | public static BattleEffectPlayer Create(int effectId, Transform parent, bool isRedCamp) |
| | | { |
| | | // 直接创建特效播放器,不使用对象池 |
| | | BattleEffectPlayer battleEffectPlayer = null; |
| | |
| | | battleEffectPlayer.rectTrans = newGo.AddMissingComponent<RectTransform>(); |
| | | |
| | | battleEffectPlayer.effectId = effectId; |
| | | |
| | | // 设置阵营 |
| | | battleEffectPlayer.isRedCamp = isRedCamp; |
| | | |
| | | battleEffectPlayer.SetActive(true); |
| | | return battleEffectPlayer; |
| | | } |
| | |
| | | effectDict[effectId] = new List<BattleEffectPlayer>(); |
| | | } |
| | | |
| | | bool isRedCamp = camp == BattleCamp.Red; |
| | | |
| | | BattleEffectPlayer effectPlayer = BattleEffectPlayer.Create(effectId, battleField.battleRootNode.transform); |
| | | BattleEffectPlayer effectPlayer = BattleEffectPlayer.Create(effectId, battleField.battleRootNode.transform, isRedCamp); |
| | | // 设置特效缩放和方向 |
| | | |
| | | effectPlayer.transform.position = parent.position; |
| | |
| | | effectPlayer.Play(true); |
| | | |
| | | var effectScale = effectPlayer.transform.localScale; |
| | | effectScale.x *= camp == BattleCamp.Red ? 1 : -1; |
| | | effectScale.x *= isRedCamp ? 1 : -1; |
| | | effectPlayer.transform.localScale = effectScale; |
| | | |
| | | return effectPlayer; |
| | |
| | | if (null != bulletTrans) |
| | | { |
| | | bulletTrans.anchoredPosition = pos; |
| | | |
| | | } |
| | | |
| | | Vector2 dir = end - start; |
| | | float angle = Mathf.Atan2(dir.y, dir.x) * Mathf.Rad2Deg; |
| | | float angle = Mathf.Atan2(dir.y, dir.x) * Mathf.Rad2Deg + (caster.Camp == BattleCamp.Red ? 0 : 180); |
| | | if (null != bulletTrans) |
| | | { |
| | | bulletTrans.localRotation = Quaternion.Euler(0, bulletTrans.transform.localScale.x < 0f ? 180 : 0, angle); |
| | | bulletTrans.rotation = Quaternion.Euler(0, 0, angle); |
| | | } |
| | | // if (bulletTrans.transform.localScale.x < 0f) |
| | | // { |
| | | // bulletTrans.transform.localRotation *= Quaternion.Euler(0, 180, 0); |
| | | // } |
| | | |
| | | if (t >= 1f) |
| | | { |
| | | finished = true; |
| | |
| | | isCurveFinish |= bulletCurve.IsFinished; |
| | | } |
| | | |
| | | return isCurveFinish && isFinish; |
| | | return isCurveFinish && base.IsFinished(); |
| | | } |
| | | } |
| | |
| | | |
| | | protected bool isFinish = false; |
| | | |
| | | protected bool isFinishFrameEnd = false; |
| | | |
| | | protected Action<int, List<HB427_tagSCUseSkill.tagSCUseSkillHurt>> onHit; |
| | | |
| | | public SkillEffect(SkillConfig _skillConfig, BattleObject _caster, HB427_tagSCUseSkill _tagUseSkillAttack) |
| | |
| | | /// </summary> |
| | | public virtual void OnFinalFrameEnd() |
| | | { |
| | | |
| | | isFinishFrameEnd = true; |
| | | } |
| | | |
| | | public virtual bool IsFinished() |
| | | { |
| | | return isFinish; |
| | | return isFinish && isFinishFrameEnd; |
| | | } |
| | | |
| | | public virtual void ForceFinished() |
| | | { |
| | | isFinish = true; |
| | | isFinishFrameEnd = true; |
| | | } |
| | | } |