Exemple #1
0
    /// <summary>
    /// 注册动画对应的触发事件
    /// </summary>
    void RegisterAnimation(int key, SkillEffectPlayer effect_player)
    {
        TriggerSetting[] trigger_settings = effect_player.TriggerSettings;
        if (trigger_settings == null)
        {
            return;
        }

        // 根据TriggerSettings来进行动画事件的注册
        for (int i = 0; i < trigger_settings.GetLength(0); ++i)
        {
            int tigger_int = key * 100 + i;
            // 获取AnimationClip
            TriggerSetting trigger_setting = trigger_settings[i];
            AnimationClip  animation_clip  = trigger_setting.Animation;
            if (animation_clip == null)
            {
                GameDebug.LogError(effect_player.gameObject.name + "'s animationclip is null");
                continue;
            }

            // 初始化回调相关参数
            CallBackInfo info = new CallBackInfo();
            info.mTime     = trigger_setting.StartFrame * 0.0333f;
            info.mCallBack = effect_player.OnFrameHit;
            info.mParam    = trigger_setting;
            // 注册回调事件
            RegisterEvent(tigger_int, animation_clip.name, info);
        }
    }
Exemple #2
0
    void Awake()
    {
        var animator = GetComponent <Animator>();

        if (animator != null)
        {
            animator.cullingMode = CullMode;
            _animator            = animator;
        }

        if (mSkillEffectPlayer == null)
        {
            mSkillEffectPlayer = GetComponent <SkillEffectPlayer>();
        }

        RegisterStageEvent();
    }
Exemple #3
0
        /// <summary>
        /// 进入死亡状态
        /// </summary>
        public void EnterState_Death(xc.Machine.State s)
        {
            m_Gravity = DBActor.Gravity;

            // 下坐骑
            if (mOwner.mRideCtrl != null && mOwner.mRideCtrl.IsRiding())
            {
                mOwner.mRideCtrl.UnRide(true);
            }

            // Unfreeze
            mOwner.UnFreeze();

            // 获取死亡动作
            AnimationOptions op = GetAnimationOptions(Actor.EAnimation.death);

            bool is_shape_shifted = mOwner.IsShapeShift;// 删除buff前判断是否在变身状态

            // 删除buff
            if (mOwner.BuffCtrl != null)
            {
                mOwner.BuffCtrl.DelAllBuff();
            }

            if (!mIsDead)            // 角色之前还进入死亡时,则播放死亡动作
            {
                mIsDead = true;

                // 先检查是否有浮空动作
                AnimationOptions floatingOp = GetAnimationOptions(Actor.EAnimation.floating);
                if (!mOwner.HasAnimation(floatingOp.Name) || is_shape_shifted)// 变身状态、没有击飞动画时
                {
                    mDeathInfo.IsFlying = false;
                }

                if (!mDeathInfo.IsFlying)
                {
                    PlayAnimation(op);
                }
                else
                {
                    // 移动方向
                    MoveDir = mDeathInfo.MoveDir;
                    // 移动速度
                    MoveSpeed      = mDeathInfo.MoveXSpeed;
                    mVerticalSpeed = mDeathInfo.MoveYSpeed;
                    m_Gravity      = mOwner.ActorAttribute.Gravity;
                    // 播放动画
                    PlayAnimation(floatingOp);

                    mSwitch       = false;
                    mDeathFlyDown = false;
                }
            }
            else
            {
                SkillEffectPlayer effect_player = mOwner.SkillEffectPlayer;
                if (effect_player != null)
                {
                    effect_player.PlayEffect(DeathAnimation);
                }
            }

            if (mOwner.IsLocalPlayer)
            {
                ClientEventMgr.GetInstance().FireEvent((int)ClientEvent.CE_LOCAL_PLAYER_NWAR_DEAD, null);
            }

            if (SceneHelp.Instance.IsInWorldBossExperienceInstance && mOwner.IsLocalPlayer == false && mOwner.IsPlayer())
            {
                mOwner.SetNameLayoutVisiable(false);
            }
        }