예제 #1
0
        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;
            }
        }
예제 #2
0
        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;
            }
        }