Commit e182fcc4 authored by Chunchi Che's avatar Chunchi Che

add OnPointerOverTrigger and OnPointerOutTrigger event

parent b0bdea90
Pipeline #18496 passed with stages
in 3 minutes and 4 seconds
...@@ -55,6 +55,12 @@ export const HandRotation = () => { ...@@ -55,6 +55,12 @@ export const HandRotation = () => {
export const HandColor = () => { export const HandColor = () => {
return BABYLON.Color3.White(); return BABYLON.Color3.White();
}; };
export const HandHoverScaling = () => {
return new BABYLON.Vector3(1.2, 1.2, 1);
};
export const HandHoverOutScaling = () => {
return new BABYLON.Vector3(1, 1, 1);
};
// 怪兽区 // 怪兽区
export const MonsterColor = () => { export const MonsterColor = () => {
......
...@@ -42,11 +42,24 @@ export default (hands: Card[], scene: BABYLON.Scene) => { ...@@ -42,11 +42,24 @@ export default (hands: Card[], scene: BABYLON.Scene) => {
); );
// 监听`Hover`事件 // 监听`Hover`事件
hand.actionManager.registerAction( hand.actionManager.registerAction(
new BABYLON.ExecuteCodeAction( new BABYLON.SetValueAction(
BABYLON.ActionManager.OnPointerOverTrigger, {
(event) => { trigger: BABYLON.ActionManager.OnPointerOverTrigger,
console.log(`<Hover>hand: ${idx}`, "card:", item, "event:", event); },
} hand,
"scaling",
CONFIG.HandHoverScaling()
)
);
// 监听`Hover`离开事件
hand.actionManager.registerAction(
new BABYLON.SetValueAction(
{
trigger: BABYLON.ActionManager.OnPointerOutTrigger,
},
hand,
"scaling",
CONFIG.HandHoverOutScaling()
) )
); );
}); });
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment