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 = () => {
export const HandColor = () => {
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 = () => {
......
......@@ -42,11 +42,24 @@ export default (hands: Card[], scene: BABYLON.Scene) => {
);
// 监听`Hover`事件
hand.actionManager.registerAction(
new BABYLON.ExecuteCodeAction(
BABYLON.ActionManager.OnPointerOverTrigger,
(event) => {
console.log(`<Hover>hand: ${idx}`, "card:", item, "event:", event);
}
new BABYLON.SetValueAction(
{
trigger: BABYLON.ActionManager.OnPointerOverTrigger,
},
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