Commit 7d0f6506 authored by Chunchi Che's avatar Chunchi Che

update drawing duel

parent 41e6afe3
Pipeline #18134 passed with stages
in 2 minutes and 34 seconds
......@@ -6,10 +6,10 @@
import * as BABYLON from "@babylonjs/core";
export const GroundShape = () => {
return { width: 6, height: 6 };
return { width: 9.9, height: 8 };
};
export const CardSlotShape = () => {
return { width: 0.5, height: 0.75, depth: 0.05 };
return { width: 1, height: 1.2, depth: 0.05 };
};
export const CardSlotRotation = () => {
return new BABYLON.Vector3(1.5, 0, 0);
......
......@@ -43,7 +43,7 @@ export default class SimpleDuelPlateImpl implements IDuelPlate {
// 创建Camera
const camera = new BABYLON.FreeCamera(
"camera1",
new BABYLON.Vector3(0, 5, -10), // 俯视方向
new BABYLON.Vector3(0, 12, 0), // 俯视方向
scene
);
camera.setTarget(BABYLON.Vector3.Zero()); // 俯视向前
......@@ -58,17 +58,31 @@ export default class SimpleDuelPlateImpl implements IDuelPlate {
light.intensity = 0.7;
// 魔法陷阱区
renderMagics(scene);
// renderMagics(scene);
// 怪兽区
renderMonsters(scene);
// 创建额外怪兽区
renderExtraMonsters(scene);
// renderExtraMonsters(scene);
// 创建手牌
renderHands(hands, scene);
// 暂时不创建地板
// 创建地板
const ground = BABYLON.MeshBuilder.CreateGround(
"ground",
CONFIG.GroundShape(),
scene
);
const groundMaterial = new BABYLON.StandardMaterial(
"groundMaterial",
scene
);
groundMaterial.diffuseTexture = new BABYLON.Texture(
`http://localhost:3030/images/newfield.png`
);
ground.material = groundMaterial;
// 渲染循环
engine.runRenderLoop(() => {
......
......@@ -2,8 +2,8 @@ import * as BABYLON from "@babylonjs/core";
import * as CONFIG from "./config";
export default (scene: BABYLON.Scene) => {
const left = -2;
const gap = 1;
const left = -2.15;
const gap = 1.05;
for (let i = 0; i < 5; i++) {
const slot = BABYLON.MeshBuilder.CreateBox(
`monster${i}`,
......@@ -11,7 +11,7 @@ export default (scene: BABYLON.Scene) => {
scene
);
// 位置
slot.position = new BABYLON.Vector3(left + gap * i, 0.5, -2);
slot.position = new BABYLON.Vector3(left + gap * i, 0.5, -2.5);
// 旋转
slot.rotation = CONFIG.CardSlotRotation();
// 材质
......
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