Skip to content

Commit 2bef6ce

Browse files
committed
feat: 新增睡眠和控制其他角色相关动画参数
- 新增 Sleeping、IsVehicle、IsControllingOtherCharacter、IsControllingVehicle 四个 bool 类型动画参数 - 新增 CA_ControlOtherCharacter 动作类型(ID: 10) - 版本号更新至 v1.10.7
1 parent 87f124e commit 2bef6ce

8 files changed

Lines changed: 68 additions & 1 deletion

File tree

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,16 @@
22

33
[English](CHANGELOG_EN.md) | 中文
44

5+
## v1.10.7
6+
7+
- 新增动画参数支持
8+
- 新增 `Sleeping`(bool):角色是否处于睡眠状态
9+
- 新增 `IsVehicle`(bool):角色是否为载具
10+
- 新增 `IsControllingOtherCharacter`(bool):角色是否正在控制其他角色
11+
- 新增 `IsControllingVehicle`(bool):角色是否正在控制载具(为 `true` 时,`IsControllingOtherCharacter` 必定为 `true`
12+
- 新增动作类型支持
13+
- 新增 `CA_ControlOtherCharacter`(控制其他角色)动作类型(ID: 10)
14+
515
## v1.10.6
616

717
- 调整了模型身高调整滑条功能,现在允许点击左侧按钮切换至输入框输入以更精确地设置数值

CHANGELOG_EN.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,16 @@
22

33
English | [中文](CHANGELOG.md)
44

5+
## v1.10.7
6+
7+
- Added new animator parameters support
8+
- Added `Sleeping` (bool): Whether the character is in sleeping state
9+
- Added `IsVehicle` (bool): Whether the character is a vehicle
10+
- Added `IsControllingOtherCharacter` (bool): Whether the character is controlling another character
11+
- Added `IsControllingVehicle` (bool): Whether the character is controlling a vehicle (when `true`, `IsControllingOtherCharacter` is always `true`)
12+
- Added new action type support
13+
- Added `CA_ControlOtherCharacter` (control other character) action type (ID: 10)
14+
515
## v1.10.6
616

717
- Adjusted model scale slider functionality, now allows clicking the left button to switch to input box for more precise scale value setting

DuckovCustomModel.Core/Data/CustomAnimatorHash.cs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,14 @@ public static class CustomAnimatorHash
102102
public static readonly int EmotionValue1 = Animator.StringToHash("EmotionValue1"); // int
103103
public static readonly int EmotionValue2 = Animator.StringToHash("EmotionValue2"); // int
104104

105+
public static readonly int Sleeping = Animator.StringToHash("Sleeping"); // bool
106+
public static readonly int IsVehicle = Animator.StringToHash("IsVehicle"); // bool
107+
108+
public static readonly int
109+
IsControllingOtherCharacter = Animator.StringToHash("IsControllingOtherCharacter"); // bool
110+
111+
public static readonly int IsControllingVehicle = Animator.StringToHash("IsControllingVehicle"); // bool
112+
105113
public static List<AnimatorParamInfo> GetAllParams()
106114
{
107115
return new List<AnimatorParamInfo>
@@ -192,6 +200,15 @@ public static List<AnimatorParamInfo> GetAllParams()
192200
},
193201
new() { Name = "EmotionValue1", Hash = EmotionValue1, Type = "int", InitialValue = 0 },
194202
new() { Name = "EmotionValue2", Hash = EmotionValue2, Type = "int", InitialValue = 0 },
203+
new() { Name = "Sleeping", Hash = Sleeping, Type = "bool", InitialValue = false },
204+
new() { Name = "IsVehicle", Hash = IsVehicle, Type = "bool", InitialValue = false },
205+
new()
206+
{
207+
Name = "IsControllingOtherCharacter", Hash = IsControllingOtherCharacter, Type = "bool",
208+
InitialValue = false,
209+
},
210+
new()
211+
{ Name = "IsControllingVehicle", Hash = IsControllingVehicle, Type = "bool", InitialValue = false },
195212
}.OrderBy(p => p.Name).ToList();
196213
}
197214
}

DuckovCustomModel/Constant.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ public static class Constant
44
{
55
public const string ModID = "DuckovCustomModel";
66
public const string ModName = "Duckov Custom Model";
7-
public const string ModVersion = "1.10.6";
7+
public const string ModVersion = "1.10.7";
88
public const string HarmonyId = "com.ritsukage.DuckovCustomModel";
99
}
1010
}

DuckovCustomModel/Data/CharacterActionDefinitions.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ static CharacterActionDefinitions()
1818
RegisterActionType<CA_Reload>(7);
1919
RegisterActionType<CA_Skill>(8);
2020
RegisterActionType<CA_UseItem>(9);
21+
RegisterActionType<CA_ControlOtherCharacter>(10);
2122
}
2223

2324
public static IReadOnlyDictionary<Type, int> GetActionTypes()

DuckovCustomModel/Managers/Updaters/CharacterStatusUpdater.cs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,25 @@ public void UpdateParameters(CustomAnimatorControl control)
5555
_ => (int)CharacterMainControl.WeightStates.light,
5656
};
5757
control.SetParameterInteger(CustomAnimatorHash.WeightState, weightState);
58+
59+
control.SetParameterBool(CustomAnimatorHash.Sleeping, control.CharacterMainControl.Sleeping);
60+
61+
control.SetParameterBool(CustomAnimatorHash.IsVehicle, control.CharacterMainControl.isVehicle);
62+
63+
var isControlling = false;
64+
var isControllingVehicle = false;
65+
if (control.CharacterMainControl.controlOtherCharacterAction != null)
66+
{
67+
var haveTargetCharacter =
68+
control.CharacterMainControl.controlOtherCharacterAction.targetCharacter != null;
69+
isControlling = haveTargetCharacter &&
70+
control.CharacterMainControl.controlOtherCharacterAction.Running;
71+
isControllingVehicle = isControlling &&
72+
control.CharacterMainControl.controlOtherCharacterAction.vehicleControl;
73+
}
74+
75+
control.SetParameterBool(CustomAnimatorHash.IsControllingOtherCharacter, isControlling);
76+
control.SetParameterBool(CustomAnimatorHash.IsControllingVehicle, isControllingVehicle);
5877
}
5978
}
6079
}

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -586,6 +586,10 @@ Animator Controller 可以使用以下参数:
586586
- `BackpackEquip`:背包槽位是否有装备(基于装备的 TypeID 判断,TypeID > 0 时为 `true`)
587587
- `MeleeWeaponEquip`:近战武器槽位是否有装备(基于装备的 TypeID 判断,TypeID > 0 时为 `true`)
588588
- `HavePopText`:是否有弹出文本(检测弹出文本槽位是否有子对象)
589+
- `Sleeping`:角色是否处于睡眠状态
590+
- `IsVehicle`:角色是否为载具
591+
- `IsControllingOtherCharacter`:角色是否正在控制其他角色
592+
- `IsControllingVehicle`:角色是否正在控制载具(为 `true` 时,`IsControllingOtherCharacter` 必定为 `true`)
589593

590594
#### Float 类型参数
591595

@@ -679,6 +683,7 @@ Animator Controller 可以使用以下参数:
679683
- `7`:CA_Reload(装弹)
680684
- `8`:CA_Skill(技能)
681685
- `9`:CA_UseItem(使用物品)
686+
- `10`:CA_ControlOtherCharacter(控制其他角色)
682687
- 当 `ActionRunning` 为 `true` 时,动作类型可以精确判断角色正在执行的动作类型
683688
- 动作类型定义库支持扩展,可通过 `CharacterActionDefinitions.RegisterActionType<T>(id)` 注册新的动作类型
684689
- `ActionFishingRodTypeID`:钓鱼动作中使用的鱼竿 TypeID(仅在 `ActionType` 为 `1` 或 `2` 时有效,其他情况为 `0`)

README_EN.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -603,6 +603,10 @@ The Animator Controller can use the following parameters:
603603
- `BackpackEquip`: Whether there is equipment in the backpack slot (determined by equipment TypeID, `true` when TypeID > 0)
604604
- `MeleeWeaponEquip`: Whether there is equipment in the melee weapon slot (determined by equipment TypeID, `true` when TypeID > 0)
605605
- `HavePopText`: Whether there is pop text (checks if the pop text slot has child objects)
606+
- `Sleeping`: Whether the character is in sleeping state
607+
- `IsVehicle`: Whether the character is a vehicle
608+
- `IsControllingOtherCharacter`: Whether the character is controlling another character
609+
- `IsControllingVehicle`: Whether the character is controlling a vehicle (when `true`, `IsControllingOtherCharacter` is always `true`)
606610

607611
#### Float Type Parameters
608612

@@ -696,6 +700,7 @@ The Animator Controller can use the following parameters:
696700
- `7`: CA_Reload
697701
- `8`: CA_Skill
698702
- `9`: CA_UseItem
703+
- `10`: CA_ControlOtherCharacter (control other character)
699704
- When `ActionRunning` is `true`, the action type can precisely determine what action type the character is performing
700705
- The action type definition library supports extensions, new action types can be registered via `CharacterActionDefinitions.RegisterActionType<T>(id)`
701706
- `ActionFishingRodTypeID`: TypeID of fishing rod used in fishing action (only valid when `ActionType` is `1` or `2`, otherwise `0`)

0 commit comments

Comments
 (0)