public void PlayEffect(HitEffectType hitEffectType, MatType matType, Vector3 worldPos) { try { string key = hitEffectType.ToString() + "_" + matType.ToString(); string AudioID = AudioIDDic[key.ToLower()]; AudioAttackName audioAttackName = AudioNameDic[AudioID]; string AudioKey = ""; int temp = UnityEngine.Random.Range(0, 3); switch (temp) { case 0: AudioKey = audioAttackName.AudioName1; break; case 1: AudioKey = audioAttackName.AudioName2; break; case 2: AudioKey = audioAttackName.AudioName3; break; } PlayEffect(AudioKey, worldPos); } catch (Exception e) { Console.WriteLine(e); } finally { } }
public AttackFlow(IAttacker attacker, IOnAttacked target, int damage, bool isCritical, HitEffectType hitEffectType) { Attacker = attacker; Target = target; Damage = damage; IsCritical = isCritical; HitEffectType = hitEffectType; }
public void PopupHitEffect(HitEffectType type, IPhotonBehaviour target) { if (type == HitEffectType.None) { return; } Instantiate(_hitEffectPref[_index[type]], target.transform); }
public void PlayHurtEffect(HitEffectType hitEffectType, MatType matType, Vector3 pos, Direction direction, float rendererAngle, Vector3 force) { HitAndMatData hitAndMatData = GetHitAndMatData(hitEffectType, matType); if (hitAndMatData == null) { return; } EffectAnim effectAnim = GetEffectAnim(hitAndMatData.HurtEffectId); if (effectAnim == null) { return; } switch (effectAnim._AnimType) { case AnimType.spine: switch (effectAnim.mode) { case modeType.random: AnimManager.Instance.PlayAnim(Tools.getOnlyId().ToString(), Definition.SpineAssetPath + "/" + effectAnim.AnimName + ".asset", choiceAnim(effectAnim), false, pos, (int)direction); break; default: AnimManager.Instance.PlayAnim(Tools.getOnlyId().ToString(), Definition.SpineAssetPath + "/" + effectAnim.AnimName + ".asset", effectAnim.Anim1, false, pos, (int)direction); break; } AnimManager.Instance.PlayAnim(Tools.getOnlyId().ToString(), Definition.SpineAssetPath + "/" + effectAnim.AnimName + ".asset", effectAnim.Anim1, false, pos, (int)direction); break; case AnimType.effect: if (direction == Direction.Right) { AnimManager.Instance.PlayAnimEffect(effectAnim.AnimName, pos, 0, false, Vector3.zero, null, 0, controller => { }); } else { AnimManager.Instance.PlayAnimEffect(effectAnim.AnimName, pos, rendererAngle, true); } break; default: Debug.LogError("不存在类型:" + effectAnim._AnimType); break; } }
public async void PlayHitEffect(HitEffectType hitEffectType, MatType matType, Vector3 pos, Direction direction, float rendererAngle) { rendererAngle = 0; HitAndMatData hitAndMatData = GetHitAndMatData(hitEffectType, matType); if (hitAndMatData == null) { return; } EffectAnim effectAnim = GetEffectAnim(hitAndMatData.HitEffectId); if (effectAnim == null) { return; } switch (effectAnim._AnimType) { case AnimType.spine: GameObject animObject = await AnimManager.Instance.PlayAnim(Tools.getOnlyId().ToString(), Definition.SpineAssetPath + "/" + effectAnim.AnimName + ".asset", effectAnim.Anim1, false, pos, (int)direction); animObject.transform.eulerAngles = new Vector3(animObject.transform.eulerAngles.x, animObject.transform.eulerAngles.y, rendererAngle); break; case AnimType.effect: if (direction == Direction.Right) { AnimManager.Instance.PlayAnimEffect(effectAnim.AnimName, pos, rendererAngle); } else { AnimManager.Instance.PlayAnimEffect(effectAnim.AnimName, pos, rendererAngle, true); } break; default: Debug.LogError("不存在类型:" + effectAnim._AnimType); break; } }
protected abstract void RpcCreateShotEffect(HitEffectType type, Vector3 location, Vector3 normal);
private void SyncAttackRPC(int attackerViewID, int targetViewID, int damage, bool isCritical, HitEffectType hitEffectType) { var attacker = PhotonView.Find(attackerViewID).gameObject.GetComponent <IAttacker>(); var target = PhotonView.Find(targetViewID).gameObject.GetComponent <IOnAttacked>(); Assert.IsNotNull(attacker); Assert.IsNotNull(target); var flow = new AttackFlow(attacker, target, damage, isCritical, hitEffectType); SkillStream.OnNextAttack(flow); }
public void SyncAttack(int attackerViewID, int targetViewID, int damage, bool isCritical, HitEffectType hitEffectType) { photonView.RPC("SyncAttackRPC", PhotonTargets.AllViaServer, attackerViewID, targetViewID, damage, isCritical, hitEffectType); }
public HitAndMatData GetHitAndMatData(HitEffectType hitEffectType, MatType matType) { string key = hitEffectType.ToString().ToLower() + "_" + matType.ToString().ToLower(); return(GetHitAndMatData(key)); }