예제 #1
0
    //动作在地面还是空中
    //动作是移动 防守 还是攻击 受伤 待机
    public void ChangeActionSingle(int idx = CommonAction.Idle)
    {
        if (ActionList[UnitId].Count > idx && load != null)
        {
            CanMove = false;
            if (idx == CommonAction.Defence)
            {
                switch ((EquipWeaponType)_Self.GetWeaponType())
                {
                case EquipWeaponType.Knife: idx = CommonAction.KnifeDefence; break;

                case EquipWeaponType.Sword: idx = CommonAction.SwordDefence; break;

                case EquipWeaponType.Blade: idx = CommonAction.BladeDefence; break;

                case EquipWeaponType.Lance: idx = CommonAction.LanceDefence; break;

                case EquipWeaponType.Brahchthrust: idx = CommonAction.BrahchthrustDefence; break;

                //case EquipWeaponType.Dart: idx = CommonAction.DartDefence;break;
                case EquipWeaponType.Gloves: idx = CommonAction.ZhihuDefence; break;    //没找到

                //case EquipWeaponType.Guillotines: idx = CommonAction.GuillotinesDefence;break;
                case EquipWeaponType.Hammer: idx = CommonAction.HammerDefence; break;

                case EquipWeaponType.NinjaSword: idx = CommonAction.RendaoDefence; break;

                case EquipWeaponType.HeavenLance: idx = CommonAction.QiankunDefenct; break;    //
                                                                                               //case EquipWeaponType.Gun: return;//
                }
            }
            else
            if (idx == CommonAction.Jump)
            {
                CanMove = true;//跳跃后,可以微量移动
            }
            //else if (idx == Data.CommonActionI.ShortJump)
            //{
            //    CanChangeWeapon = false;//空中不可换武器
            //    CanMove = true;
            //}
            else if ((idx >= CommonAction.WalkForward && idx <= CommonAction.RunOnDrug) || idx == CommonAction.Crouch)
            {
                CanMove = true;
            }
            else if (idx == CommonAction.Idle)
            {
                CanMove = true;
            }
            load.SetPosData(ActionList[UnitId][idx], 0, true);
            load.Pause    = false;
            mActiveAction = ActionList[UnitId][idx];
        }
    }
예제 #2
0
파일: PoseStatus.cs 프로젝트: Roy-H/Meteor
 public void ChangeAction(int idx = CommonAction.Idle, float time = 0.0f, int targetFrame = 0)
 {
     if (characterLoader != null)
     {
         characterLoader.SetPosData(ActionList[EntityId][idx], time, false, targetFrame);
     }
 }
예제 #3
0
    public void ChangeAction(int idx = CommonAction.Idle, float time = 0.01f)
    {
        //if (idx == 151 || idx == 152)
        //{
        //    string stackInfo = new StackTrace().ToString();
        //    UnityEngine.Debug.Log(stackInfo);
        //}
        CanAdjust = false;
        if (_Self.GameFinished && !playResultAction && (idx == CommonAction.Idle || idx == CommonAction.GunIdle))
        {
            playResultAction = true;
            if (_Self.Camp == EUnitCamp.EUC_ENEMY && Main.Ins.GameBattleEx.BattleLose())
            {
                ChangeAction(CommonAction.Taunt, 0.1f);
                return;
            }
            else if (_Self.Camp == EUnitCamp.EUC_FRIEND && Main.Ins.GameBattleEx.BattleWin())
            {
                ChangeAction(CommonAction.Taunt, 0.1f);
                return;
            }
        }

        _Self.IgnoreGravitys(PoseStatus.IgnoreGravity(idx));//设置招式重力
        bool ignorePhy = IgnorePhysical(idx);

        if (ignorePhy != _Self.IgnorePhysical)
        {
            Main.Ins.MeteorManager.PhysicalIgnore(_Self, ignorePhy);//设置招式是否忽略角色障碍
        }
        //看是否是大绝的起始招式/结束招式,大绝起始和结束招式之间的招式,不许响应输入切换招式.大绝不可取消.
        if (IsSkillStartPose(idx) && !_Self.IsPlaySkill)
        {
            _Self.IsPlaySkill = true;
        }
        else if ((IsSkillEndPose(idx) || onhurt) && _Self.IsPlaySkill)
        {
            _Self.IsPlaySkill = false;
        }

        //设置招式是否冻结世界轴XZ上得速度.
        _Self.ResetWorldVelocity(IgnoreVelocityXZ(idx));
        if (load != null)
        {
            int weapon = _Self.GetWeaponType();
            CanMove = false;
            if (idx == CommonAction.Defence)
            {
                switch ((EquipWeaponType)weapon)
                {
                case EquipWeaponType.Knife: idx = CommonAction.KnifeDefence; break;

                case EquipWeaponType.Sword: idx = CommonAction.SwordDefence; break;

                case EquipWeaponType.Blade: idx = CommonAction.BladeDefence; break;

                case EquipWeaponType.Lance: idx = CommonAction.LanceDefence; break;

                case EquipWeaponType.Brahchthrust: idx = CommonAction.BrahchthrustDefence; break;

                //case EquipWeaponType.Dart: idx = CommonAction.DartDefence;break;
                case EquipWeaponType.Gloves: idx = CommonAction.ZhihuDefence; break;    //没找到

                //case EquipWeaponType.Guillotines: idx = CommonAction.GuillotinesDefence;break;
                case EquipWeaponType.Hammer: idx = CommonAction.HammerDefence; break;

                case EquipWeaponType.NinjaSword: idx = CommonAction.RendaoDefence; break;

                case EquipWeaponType.HeavenLance: idx = CommonAction.QiankunDefenct; break;    //
                                                                                               //case EquipWeaponType.Gun: return;//
                }
            }
            else
            if (idx == CommonAction.Jump)
            {
                CanAdjust = true;//跳跃后,可以微量移动
                CanMove   = true;
            }
            else if ((idx >= CommonAction.WalkForward && idx <= CommonAction.RunOnDrug) || idx == CommonAction.Crouch)
            {
                CanMove = true;
            }
            else if (idx == CommonAction.Idle)
            {
                CanMove = true;
            }

            //蹲下左右旋转-蹲下前后左右移动,只要之前处于火枪预备则都可以瞬间出火枪的攻击
            if (weapon == (int)EquipWeaponType.Gun)
            {
                if ((idx >= CommonAction.CrouchForw && idx <= CommonAction.CrouchBack) || idx == CommonAction.GunIdle)
                {
                    if (idx == CommonAction.GunIdle && !_Self.GunReady)
                    {
                        _Self.SetGunReady(true);
                    }
                    if (_Self.Attr.IsPlayer)
                    {
                        if (_Self.GunReady)
                        {
                            Main.Ins.EnterState(Main.Ins.GunShootDialogStatus);
                        }
                        else
                        {
                            Main.Ins.ExitState(Main.Ins.GunShootDialogStatus);
                        }
                    }
                }
                else
                {
                    if (_Self.Attr.IsPlayer)
                    {
                        Main.Ins.ExitState(Main.Ins.GunShootDialogStatus);
                    }
                }
            }
            else if (_Self.Attr.IsPlayer)
            {
                Main.Ins.ExitState(Main.Ins.GunShootDialogStatus);
            }

            //除了受击,防御,其他动作在有锁定目标下,都要转向锁定目标.
            if (_Self.LockTarget != null && !onDefence && !onhurt)
            {
                //是否旋转面向目标.
                if (_Self.StateMachine != null && _Self.StateMachine.IsFighting())
                {
                    //NPC.
                    //远程武器无需转向.
                    if (_Self.GetWeaponType() != (int)EquipWeaponType.Guillotines &&
                        _Self.GetWeaponType() != (int)EquipWeaponType.Gun &&
                        _Self.GetWeaponType() != (int)EquipWeaponType.Dart)
                    {
                        _Self.FaceToTarget(_Self.LockTarget);
                    }
                }
                else if (_Self.StateMachine == null && Main.Ins.GameStateMgr.gameStatus.AutoLock && idx != CommonAction.Idle)
                {
                    //主角.
                    if (_Self.GetWeaponType() != (int)EquipWeaponType.Guillotines &&
                        _Self.GetWeaponType() != (int)EquipWeaponType.Gun &&
                        _Self.GetWeaponType() != (int)EquipWeaponType.Dart)
                    {
                        _Self.FaceToTarget(_Self.LockTarget);
                    }
                }
            }
            load.SetPosData(ActionList[UnitId][idx], time);
            mActiveAction    = ActionList[UnitId][idx];
            mActiveActionIdx = mActiveAction.Idx;
            LinkInput.Clear();
        }
    }