예제 #1
0
    private void RefreshSpacecraftMotionState(ChangeProperty changeProperty = null)
    {
        InitializeMovionAttribute();
        if (m_Property.GetCurrentState().IsHasSubState(EnumSubState.Overload))
        {
            m_CurrentMotionInfo = m_OverloadModeMotionInfo;
        }
        else if (m_Property.GetCurrentState().GetMainState() == EnumMainState.Fight)
        {
            m_CurrentMotionInfo = m_FightModeMotionInfo;
        }
        else
        {
            m_CurrentMotionInfo = m_CruiseModeMotionInfo;
        }

        /// 6dof运动类型使用过载运动参数
        if (m_Property.GetMotionType() == MotionType.Dof6)
        {
            m_CurrentMotionInfo = m_OverloadModeMotionInfo;
        }

        SendEvent(ComponentEventName.RefreshSpacecraftMimesisData, new RefreshSpacecraftMimesisDataEvent()
        {
            MimesisData = m_CurrentMotionInfo.MimesisData
        });

        if (changeProperty != null)
        {
            m_CurrentMotionInfo = changeProperty.SpacecraftMotionInfo;
        }

        m_Property.SetCurrentSpacecraftMotionInfo(m_CurrentMotionInfo);

        m_BehaviorController.InitBehaviorAbility(
            m_CurrentMotionInfo.LineAcceleration,
            m_CurrentMotionInfo.ReverseLineAcceleration,
            m_CurrentMotionInfo.ResistanceLineAcceleration,
            m_CurrentMotionInfo.LineVelocityMax,
            m_CurrentMotionInfo.ReverseLineVelocityMax,
            m_CurrentMotionInfo.AngularAcceleration,
            m_CurrentMotionInfo.ResistanceAngularAcceleration,
            m_CurrentMotionInfo.AngularVelocityMax,
            m_CurrentMotionInfo.CruiseLeapAcceleration,
            m_CurrentMotionInfo.CruiseLeapReverseAcceleration
            );

        if (m_Property.GetHeroType() == KHeroType.htPlayer)
        {
            switch (m_Property.GetMotionType())
            {
            case MotionType.Mmo:
                if (m_BehaviorController.HasBehaviorType(BehaviorController.BehaviorType.BT_WorldForceCtlMove))
                {
                    m_BehaviorController.WorldForceControlMove(m_EngineAxis, m_cameraRotate);
                }
                break;

            case MotionType.Dof4:
                if (m_BehaviorController.HasBehaviorType(BehaviorController.BehaviorType.BT_4DOFForwardMove))
                {
                    m_BehaviorController.DOF4ForwardMove(m_EngineAxis, m_cameraRotate);
                }
                break;

            case MotionType.Dof6:
                if (m_BehaviorController.HasBehaviorType(BehaviorController.BehaviorType.BT_6DOFForwardMove))
                {
                    m_BehaviorController.DOF6ForwardMove(m_EngineAxis, m_cameraRotate);
                }
                break;

            default:
                break;
            }
        }
    }