private string choiceAnim(EffectAnim effectAnim) { int temp = Random.Range(1, 6); switch (temp) { case 1: return(effectAnim.Anim1); break; case 2: return(effectAnim.Anim2); break; case 3: return(effectAnim.Anim3); break; default: return(effectAnim.Anim1); } }
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; } }