Commit 0739c158 authored by Chunchi Che's avatar Chunchi Che

rander deck

parent 3a6c9638
Pipeline #18136 passed with stages
in 2 minutes and 20 seconds
......@@ -11,9 +11,18 @@ export const GroundShape = () => {
export const CardSlotShape = () => {
return { width: 0.8, height: 1, depth: 0.05 };
};
export const DeckSlotShape = () => {
return { width: 0.8, height: 1, depth: 0.5 };
};
export const ExtraDeckSlotShape = () => {
return { width: 0.8, height: 1, depth: 0.2 };
};
export const CardSlotRotation = () => {
return new BABYLON.Vector3(1.5, 0, 0);
};
export const DeckSlotRotation = () => {
return new BABYLON.Vector3(1.5, 0, 0);
};
// 手牌
export const HandShape = () => {
......@@ -37,3 +46,13 @@ export const extraMonsterColor = () => {
export const MagicColor = () => {
return BABYLON.Color3.Blue();
};
// 卡组
export const DeckColor = () => {
return BABYLON.Color3.Gray();
};
// 额外卡组
export const ExtraDeckColor = () => {
return BABYLON.Color3.Purple();
};
import * as BABYLON from "@babylonjs/core";
import * as CONFIG from "./config";
export default (scene: BABYLON.Scene) => {
// 卡组
const deck = BABYLON.MeshBuilder.CreateBox(
"deck",
CONFIG.DeckSlotShape(),
scene
);
// 位置
deck.position = new BABYLON.Vector3(3.2, 0.5, -3.2);
// 旋转
deck.rotation = CONFIG.DeckSlotRotation();
// 材质
const deckMaterial = new BABYLON.StandardMaterial("deckMaterial", scene);
deckMaterial.diffuseColor = CONFIG.DeckColor();
deck.material = deckMaterial;
// 额外卡组
const extraDeck = BABYLON.MeshBuilder.CreateBox(
"exraDeck",
CONFIG.ExtraDeckSlotShape(),
scene
);
// 位置
extraDeck.position = new BABYLON.Vector3(-3.3, 0.5, -3.2);
// 旋转
extraDeck.rotation = CONFIG.DeckSlotRotation();
// 材质
const extraDeckMaterial = new BABYLON.StandardMaterial(
"extraDeckMaterial",
scene
);
extraDeckMaterial.diffuseColor = CONFIG.ExtraDeckColor();
extraDeck.material = extraDeckMaterial;
};
......@@ -12,6 +12,7 @@ import renderHands from "./hands";
import renderMonsters from "./monsters";
import renderExtraMonsters from "./extraMonsters";
import renderMagics from "./magics";
import renderDeck from "./deck";
import * as CONFIG from "./config";
import { CardMeta } from "../../../api/cards";
......@@ -69,6 +70,9 @@ export default class SimpleDuelPlateImpl implements IDuelPlate {
// 创建手牌
renderHands(hands, scene);
// 创建卡组
renderDeck(scene);
// 创建地板
const ground = BABYLON.MeshBuilder.CreateGround(
"ground",
......
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