Exemplo n.º 1
0
    private void ChangeStatus(EmActorStatus s)
    {
        if (curStatus == s && s != EmActorStatus.DoAttack)
        {
            Debug.LogWarning("Reset staus: " + s);
        }
        timer = 0;
        switch (s)
        {
        case EmActorStatus.Idle:
            statusDuration = PlayAnimation(EmActorAnimationName.Idle);
            break;

        case EmActorStatus.Walk:
            statusDuration = PlayAnimation(EmActorAnimationName.Walk);
            break;

        case EmActorStatus.Run:
            statusDuration = PlayAnimation(EmActorAnimationName.Run);
            break;

        case EmActorStatus.Jump:
            moveDirection = Vector3.zero;
            curFallSpeed  = curAttribute.jumpYSpeed;
            PlayAnimation(EmActorAnimationName.Jump);
            break;

        case EmActorStatus.JumpHigh_Up:
            moveDirection = Vector3.zero;
            curFallSpeed  = curAttribute.jumpYSpeed;
            PlayAnimation(EmActorAnimationName.JumpHigh_Up);
            break;

        case EmActorStatus.JumpHigh_Down:
            moveDirection = Vector3.zero;
            PlayAnimation(EmActorAnimationName.JumpHigh_Down);
            break;

        case EmActorStatus.JumpBack:
            moveDirection  = Vector3.zero;
            curFallSpeed   = curAttribute.jumpBackYSpeed;
            statusDuration = PlayAnimation(EmActorAnimationName.JumpBack);
            break;

        case EmActorStatus.CastAttackChargeStart:
            statusDuration = PlayAnimation(EmActorAnimationName.CastAttackChargeStart);
            break;

        case EmActorStatus.CastAttackCharging:
            statusDuration = mySkill.curAttackConf.castTime;
            break;

        case EmActorStatus.CastAttack:
            statusDuration = PlayAnimation(EmActorAnimationName.CastAttack);
            break;

        case EmActorStatus.DoAttack:
            bool canSpeedUp = mySkill.skillID <= 100003 || mySkill.skillID == 100101;             //就这么几个技能动作受加速影响
            statusDuration = PlayAnimation(mySkill.curAttackConf.actorClipName, canSpeedUp);
            mySkill.DoCurAttack();
            break;

        case EmActorStatus.BeAttackedFrozen:
        case EmActorStatus.BeAttackedHitMove:
        case EmActorStatus.BeAttackedHitMoveDist:
        case EmActorStatus.BeAttackedToss:
            if (objectbase.realLocalPos.y > STAND_ON_GROUND_THROLD)
            {
                PlayAnimation(damageConf.actorBeHitFlyInAirAnima);
            }
            else
            {
                PlayAnimation(damageConf.actorBeHitStandOnGroundAnima);
            }
            statusDuration = damageConf.hitMoveTime;
            break;

        case EmActorStatus.BeAttackedFallOff:
            PlayAnimation(EmActorAnimationName.BeAttackedFly);            //横躺着"飞"下来
            break;

        case EmActorStatus.BeAttackedLieOnGround:
            PlayAnimation(EmActorAnimationName.BeAttackedLieOnGround);
            statusDuration = SkillAttack.GetDamageDuration(damageConf);
            break;

        case EmActorStatus.BeAttackedFallDown:
            statusDuration = PlayAnimation(EmActorAnimationName.BeAttackedFallDown);
            break;

        case EmActorStatus.BeAttackedFreeze:
            PlayAnimation(EmActorAnimationName.BeAttacked);
            if (actorCurStatus != EmActorStatus.BeAttackedFreeze)
            {
                //如果当前正处于冰冻状态,则不用播
                statusDuration = damageConf.damageStatusEffectDuration;
                freezeEffect   = EffectManager.GetEffect(GameConfig.effect_Common_Freeze, transform);
                freezeEffect.effectObject.realLocalPos = new Vector3(0, -10, -10);
                freezeEffect.x2dEffect.Play();
            }
            break;

        case EmActorStatus.BeAttackedMelt:
            PlayAnimation(EmActorAnimationName.BeAttacked);
            meltEffect = EffectManager.GetEffect(GameConfig.effect_Common_Melt, transform);
            meltEffect.x2dEffect.Play();
            meltEffect.effectObject.realLocalPos = new Vector3(0, -10, -10);
            statusDuration = meltEffect.x2dEffect.duration;
            break;

        case EmActorStatus.BeAttackedStun:
            PlayAnimation(EmActorAnimationName.BeAttacked);
            if (actorCurStatus != EmActorStatus.BeAttackedStun)
            {
                statusDuration = damageConf.damageStatusEffectDuration;
                stunEffect     = EffectManager.GetEffect(GameConfig.effect_Common_Stun, transform);
                stunEffect.effectObject.realLocalPos = new Vector3(0, 120, -10);
                stunEffect.x2dEffect.Play();
            }
            break;

        case EmActorStatus.Parry:
            PlayAnimation(EmActorAnimationName.Parry);
            statusDuration = float.MaxValue;
            break;

        case EmActorStatus.ParryBeAttacked:
            statusDuration = PlayAnimation(EmActorAnimationName.ParryBeAttacked);
            break;

        case EmActorStatus.Die:
            if (actorType == EmActorType.MainPlayer)           //主角尸体不消失,播放倒地动作
            {
                statusDuration = 0.5f;
                PlayAnimation(EmActorAnimationName.BeAttackedFallDown);
                if (actorConf.actorID == 1001)
                {
                    audioSource.clip = ResourceLoader.LoadCharactorSound("sm_die");                    //先这样直接写死了
                    audioSource.Play();
                }
            }
            else
            {
                statusDuration = 0.1f;
            }
            break;

        case EmActorStatus.Dead:
            statusDuration = float.MaxValue;
            if (actorType == EmActorType.MainPlayer)           //主角尸体不消失
            {
                ;
            }
            else
            {
                //尸体消失,炸裂
                objectbase.x2dAnim.Stop();
                EffectObject     eo  = EffectManager.GetEffect(GameConfig.effect_MonsterDie_1, transform);
                MonsterDieEffect mdf = eo.x2dEffect.GetComponent <MonsterDieEffect>();
                eo.effectObject.realLocalPos = Vector3.zero;
                mdf.Play(eo);
            }
            GameMain.curSceneManager.ActorDead(this);
            break;
        }
        curStatus = s;
    }