-
Notifications
You must be signed in to change notification settings - Fork 17
/
Animator.lua
35 lines (30 loc) · 1.13 KB
/
Animator.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
local function find_active_char()
local avatarroot = CS.UnityEngine.GameObject.Find("/EntityRoot/AvatarRoot")
for i = 0, avatarroot.transform.childCount - 1 do
local child = avatarroot.transform:GetChild(i)
if child.gameObject.activeInHierarchy then
return child.gameObject
end
end
end
local function find_body(avatar)
for i = 0, avatar.transform.childCount - 1 do
local transform = avatar.transform:GetChild(i)
if transform.name == "OffsetDummy" then
return transform
end
end
end
local function AnimChanger()
local avatar = find_active_char()
CS.MoleMole.ActorUtils.ShowMessage(find_body(avatar):GetChild(0).name)
local obj = find_body(avatar):GetChild(0)
local ac = obj:GetComponent("Animator")
ac:Play("Standby2ClimbA", 0) --Включить анимацию
--ac:Rebind() --Отключить анимацию
end
local function onError(error)
CS.UnityEngine.GameObject.Find("/BetaWatermarkCanvas(Clone)/Panel/TxtUID"):GetComponent("Text").text = tostring(error)
CS.MoleMole.ActorUtils.ShowMessage(tostring(error))
end
xpcall(AnimChanger, onError)