diff --git a/Game/CharacterScript/Common/Move.nut b/Game/CharacterScript/Common/Move.nut index 9aa8e7c..ed7a958 100644 --- a/Game/CharacterScript/Common/Move.nut +++ b/Game/CharacterScript/Common/Move.nut @@ -8,64 +8,64 @@ /** * * @function - * @param {ActiveObject} obj + * @param {CharacterObject} obj * @returns {void} */ function checkCanChangeState_Character_Move(obj) { - //获取当前状态 - local CurState = obj.GetState(); - //得到摇杆的数据 X 和 Y的范围 -1.0 ~ 1.0 - local arr = obj.GetVars("_move_data_", "float"); - if (fabs(arr[0]) > 0.35 || fabs(arr[1]) > 0.35) { - return true; - } else return false; + //获取当前状态 + local CurState = obj.GetState() + //得到摇杆的数据 X 和 Y的范围 -1.0 ~ 1.0 + local arr = obj.GetVars("_move_data_", "float") + if (fabs(arr[0]) > 0.35 || fabs(arr[1]) > 0.35) { + return true + } else return false } /** * * @function - * @param {ActiveObject} obj + * @param {CharacterObject} obj * @returns {void} */ function SetState_Character_Move(obj) { - //获取移动数据 - local arr = obj.GetVars("_move_data_", "float"); + //获取移动数据 + local arr = obj.GetVars("_move_data_", "float") - //设置人物朝向 摇杆X轴大于0则朝右,小于0则朝左 - local SetValue = arr[0] > 0 ? 0 : 1; - if (SetValue != obj.GetDirection()) { - if (fabs(arr[0]) > 0.35) obj.SetDirection(SetValue); - //设置动作 - obj.SetAction("move"); - } else { - if (obj.GetState() != 1) obj.SetAction("move"); - } + //设置人物朝向 摇杆X轴大于0则朝右,小于0则朝左 + local SetValue = arr[0] > 0 ? 0 : 1 + if (SetValue != obj.GetDirection()) { + if (fabs(arr[0]) > 0.35) obj.SetDirection(SetValue) + //设置动作 + obj.SetAction("move") + } else { + if (obj.GetState() != 1) obj.SetAction("move") + } - local Speed = 250; - local Dir = obj.GetDirection(); - local Pos = obj.GetPosition(); - local XOffset = null; - if (fabs(arr[0]) > 0.35) XOffset = arr[0] > 0 ? Speed : -Speed; - else XOffset = 0; - local YOffset = null; - //当摇杆Y轴大于0.35或小于-0.35时,设置Y轴偏移量 - if (fabs(arr[1]) > 0.35) YOffset = arr[1] > 0 ? Speed : -Speed; - else YOffset = 0; + local Speed = 250 + local Dir = obj.GetDirection(); + local Pos = obj.GetPosition(); + local XOffset + if (fabs(arr[0]) > 0.35) XOffset = arr[0] > 0 ? Speed : -Speed + else XOffset = 0 + local YOffset + //当摇杆Y轴大于0.35或小于-0.35时,设置Y轴偏移量 + if (fabs(arr[1]) > 0.35) YOffset = arr[1] > 0 ? Speed : -Speed + else YOffset = 0 - obj.SetSpeed(XOffset, YOffset, null); + obj.SetSpeed(XOffset, YOffset, null) } /** * * @function - * @param {ActiveObject} obj + * @param {IRDSQRCharacter} obj * @param {integer} DeltaTime * @returns {void} */ function ProcState_Character_Move(obj, DeltaTime) { - //获取移动数据 - local arr = obj.GetVars("_move_data_", "float"); - if (arr[0] == 0 && arr[1] == 0) { - obj.SetState(0); - } + //获取移动数据 + local arr = obj.GetVars("_move_data_", "float") + if (arr[0] == 0 && arr[1] == 0) { + obj.SetState(0) + } } diff --git a/Game/CharacterScript/Common/Rest.nut b/Game/CharacterScript/Common/Rest.nut index e1d5be2..3a201b1 100644 --- a/Game/CharacterScript/Common/Rest.nut +++ b/Game/CharacterScript/Common/Rest.nut @@ -5,11 +5,23 @@ 文件用途:角色站立状态 */ +/** + * + * @function + * @param {IRDSQRCharacter} obj + * @returns {boolean} + */ function checkCanChangeState_Character_Rest(obj) { - + return true; } +/** + * + * @function + * @param {IRDSQRCharacter} obj + * @returns {void} + */ function SetState_Character_Rest(obj) { //设置动作 obj.SetAction("rest"); @@ -17,6 +29,13 @@ function SetState_Character_Rest(obj) { obj.SetSpeed(0, 0, null); } +/** + * + * @function + * @param {IRDSQRCharacter} obj + * @param {integer} DeltaTime + * @returns {void} + */ function ProcState_Character_Rest(obj, DeltaTime) { } \ No newline at end of file diff --git a/Game/ObjectClass/ActiveObject.nut b/Game/ObjectClass/ActiveObject.nut index 8bcfd35..e2b9da7 100644 --- a/Game/ObjectClass/ActiveObject.nut +++ b/Game/ObjectClass/ActiveObject.nut @@ -1,6 +1,5 @@ /** * Description placeholder - * @global * @param {*} Object */ class ActiveObject extends BaseObject { @@ -9,7 +8,7 @@ class ActiveObject extends BaseObject { } /** - * + * 设置三轴速度 * @function * @param {integer} x * @param {integer} y @@ -25,7 +24,7 @@ class ActiveObject extends BaseObject { } /** - * + * 获取三轴速度 * @function * @returns {any} */ diff --git a/Game/ObjectClass/BaseObject.nut b/Game/ObjectClass/BaseObject.nut index fe8b21b..73857e9 100644 --- a/Game/ObjectClass/BaseObject.nut +++ b/Game/ObjectClass/BaseObject.nut @@ -11,16 +11,16 @@ class BaseObject { } /** - * + * 获取坐标 * @function * @returns {any} */ function GetPosition() { return sq_GetPosition(C_Object); } - // + /** - * + * 设置坐标 * @function * @param {integer} x * @param {integer} y @@ -32,22 +32,22 @@ class BaseObject { } /** - * + * 获取储存器 * @function * @param {string} Name - * @param {any} Type - * @returns {any} + * @param {string} Type + * @returns {array} */ function GetVars(Name, Type) { return sq_GetVars(C_Object, Name, Type); } /** - * + * 设置储存器 * @function * @param {string} Name * @param {any} Type - * @param {any} Value + * @param {array} Value * @returns {void} */ function SetVars(Name, Type, Value) { @@ -55,7 +55,7 @@ class BaseObject { } /** - * + * 获取方向 * @function * @returns {integer} */ @@ -64,7 +64,7 @@ class BaseObject { } /** - * + * 设置方向 * @function * @param {integer} Dir * @returns {void} diff --git a/Game/ObjectClass/CharacterObject.nut b/Game/ObjectClass/CharacterObject.nut index 010dbe2..c95f509 100644 --- a/Game/ObjectClass/CharacterObject.nut +++ b/Game/ObjectClass/CharacterObject.nut @@ -3,36 +3,36 @@ * @param {*} Object */ class CharacterObject extends ActiveObject { - constructor(Object) { - base.constructor(Object); - } + constructor(Object) { + base.constructor(Object) + } - /** - * - * @function - * @returns {*} - */ - function GetState() { - return sq_GetState(C_Object); - } + /** + * 获取状态 + * @function + * @returns {integer} 状态编号 + */ + function GetState() { + return sq_GetState(C_Object) + } - /** - * - * @function - * @param {integer} State - * @returns {void} - */ - function SetState(State) { - sq_SetState(C_Object, State); - } + /** + * 设置状态 + * @function + * @param {integer} State + * @returns {void} + */ + function SetState(State) { + sq_SetState(C_Object, State) + } - /** - * - * @function - * @param {any} key - * @returns {void} - */ - function SetAction(key) { - sq_SetAction(C_Object, key); - } + /** + * 设置动作 + * @function + * @param {string} key + * @returns {void} + */ + function SetAction(key) { + sq_SetAction(C_Object, key) + } } diff --git a/Game/StateMachine/StateMachine.nut b/Game/StateMachine/StateMachine.nut index 73145a8..12c65c1 100644 --- a/Game/StateMachine/StateMachine.nut +++ b/Game/StateMachine/StateMachine.nut @@ -91,6 +91,7 @@ function StateMachine_SetState(C_Object, Job, State) { return false; } + function StateMachine_ProcState(C_Object, Job, State, DeltaTime) { //获取状态信息 local StateInfo = StateMachine.GetInstance().GetStateInfo(Job, State); diff --git a/internalInterfaceDoc/func.nut b/internalInterfaceDoc/func.nut index ddb07c3..35e173b 100644 --- a/internalInterfaceDoc/func.nut +++ b/internalInterfaceDoc/func.nut @@ -2,7 +2,7 @@ * * @function * @param {any} C_Object - * @param {integer} state + * @param {integer} state 状态编号 * @returns {void} */ function sq_SetState(C_Object, state) {} @@ -11,8 +11,7 @@ function sq_SetState(C_Object, state) {} * * @function * @param {any} C_Object - * @param {any} key - * + * @param {string} key 动作名称 * @returns {void} */ function sq_SetAction(C_Object, key) {} @@ -59,8 +58,8 @@ function sq_SetPosition(C_Object, x, y, z) {} * * @function * @param {any} C_Object - * @param {string} Name - * @param {any} Type + * @param {string} Name 储存器名称 + * @param {string} Type 数据类型(int,float,string,bool) * @returns {void} */ function sq_GetVars(C_Object, Name, Type) {} @@ -69,8 +68,8 @@ function sq_GetVars(C_Object, Name, Type) {} * * @function * @param {any} C_Object - * @param {string} Name - * @param {any} Type + * @param {string} Name 储存器名称 + * @param {string} Type 数据类型(int,float,string,bool) * @param {any} Value * @returns {void} */ @@ -89,7 +88,7 @@ function sq_GetDirection(C_Object) { * * @function * @param {any} C_Object - * @param {integer} Dir + * @param {integer} Dir 方向(0左 1右) * @returns {void} */ function sq_SetDirection(C_Object, Dir) {}