public override bool LoadSkill() { m_AttackEffect = EffectManager.Instance.CreateEffect(this, (BattleEffectType)m_SkillDisplayTab.AttackAnimType, m_SkillDisplayTab.AttackAnim, m_SkillDisplayTab.AttackLib); if (!m_AttackEffect.Load()) { Debug.LogError("Load attack effect error! " + m_SkillDisplayTab.AttackLib); return(false); } return(true); }
private void AttackEffectEndEventHandler(EffectBase effect, BattleCard target, float total_time) { effect.EffectEnd -= AttackEffectEndEventHandler; EffectManager.Instance.DestroyEffect(effect); if (!m_IsAttackEffectEnd) { PlayBehitEffect(); } m_IsAttackEffectEnd = true; EventManager.Instance.Fire(EventDefine.BATTLE_CARD_ATTACK_END, m_SkillOwner.BattleCardObj); }
private void ProjectileEffectUpdateEventHandler(EffectBase effect, BattleCard target, float total_time, float cur_time) { float x = target.BattleCardObj.transform.localPosition.x - m_SkillOwner.BattleCardObj.transform.localPosition.x; float y = target.BattleCardObj.transform.localPosition.y - m_SkillOwner.BattleCardObj.transform.localPosition.y; float distance = (float)System.Math.Sqrt(x * x + y * y); if (distance <= cur_time / total_time * 870f) { effect.EffectUpdate -= ProjectileEffectUpdateEventHandler; EffectManager.Instance.DestroyEffect(effect); PlayBehitEffect(target); } }
//受击动画- private void PlayBehitEffect(BattleCard target) { EffectBase behit_effect = m_BehitEffect.Duplicate(); behit_effect.EffectEnd += BehitEffectEndEventHandler; behit_effect.StartPos = behit_effect.EndPos = target.BattleCardObj.transform; behit_effect.MoveSpeed = 0f; behit_effect.DirectionPoint = CalculateEffectDirection(); target.AnimateBeHit(m_BehitMap[target]); target.ShowHitValue(m_BehitMap[target], this, false); behit_effect.Play(target);//播放最后调用 }
//受击动画- private void PlayBehitEffect() { foreach (BattleCard battle_card in m_TargetList) { EffectBase behit_effect = m_BehitEffect.Duplicate(); behit_effect.EffectEnd += BehitEffectEndEventHandler; behit_effect.StartPos = behit_effect.EndPos = battle_card.BattleCardObj.transform; behit_effect.MoveSpeed = 0f; behit_effect.DirectionPoint = battle_card.BattleCardObj.transform.localPosition;//CalculateEffectDirection(); battle_card.AnimateBeHit(m_BehitMap[battle_card]); battle_card.ShowHitValue(m_BehitMap[battle_card], this, false); behit_effect.Play(battle_card);//播放最后调用 } }
//子弹动画- private void PlayProjectileEffect() { foreach (BattleCard battle_card in m_TargetList) { EffectBase effect = m_ProjectileEffect.Duplicate(); effect.EffectEnd += ProjectileEffectEndEventHandler; effect.EffectUpdate += ProjectileEffectUpdateEventHandler; effect.StartPos = m_SkillOwner.BattleCardObj.transform; effect.EndPos = battle_card.BattleCardObj.transform; effect.MoveSpeed = 0f; effect.DirectionPoint = battle_card.BattleCardObj.transform.localPosition; battle_card.AnimateBeHit(m_BehitMap[battle_card]); battle_card.ShowHitValue(m_BehitMap[battle_card], this, false); effect.Play(battle_card);//播放最后调用 } }
//受击动画- private void PlayBehitEffect(BattleCard target) { //处理斗转星移 if (!HandleSkill_DZXY(3, target)) { return; } EffectBase behit_effect = m_BehitEffect.Duplicate(); behit_effect.EffectEnd += BehitEffectEndEventHandler; behit_effect.StartPos = behit_effect.EndPos = target.BattleCardObj.transform; behit_effect.MoveSpeed = 0f; behit_effect.DirectionPoint = target.BattleCardObj.transform.localPosition;//CalculateEffectDirection(); target.AnimateBeHit(m_BehitMap[target]); target.ShowHitValue(m_BehitMap[target], this, false); behit_effect.Play(target);//播放最后调用 }
//攻击动画- private void PlayAttackEffect() { m_IsAttackEffectEnd = false; EffectBase effect = m_AttackEffect;//m_AttackEffect.Duplicate(); effect.EffectEnd += AttackEffectEndEventHandler; effect.EffectUpdate += AttackEffectUpdateEventHandler; effect.StartPos = effect.EndPos = m_SkillOwner.BattleCardObj.transform; effect.MoveSpeed = 0f; effect.DirectionPoint = CalculateEffectDirection(); effect.Play(null); //播放攻击音效 AudioManager.Instance.PlayEffectSound(m_SkillDisplayTab.Music, Obj_MyselfPlayer.GetMe().acceleration); if (Obj_MyselfPlayer.GetMe().isGuideBattle) { ShowSkillName(); } }
protected virtual void OnEffectUpdate(EffectBase effect, float cur_time) { }
protected virtual void OnEffectEnd(EffectBase effect, float total_time) { }
protected virtual void OnEffectStart(EffectBase effect) { }
public void DestroyEffect(EffectBase effect) { effect.Destroy(); m_EffectList.Remove(effect); }