Commit 6e500450 authored by Chunchi Che's avatar Chunchi Che

add Field component

parent 54a8a9b8
import * as BABYLON from "@babylonjs/core";
import * as CONFIG from "../../config/ui";
export default (scene: BABYLON.Scene) => {
// 墓地
const Field = () => {
const shape = CONFIG.FieldSlotShape();
const field = BABYLON.MeshBuilder.CreateBox("field", shape);
// 位置
field.position = new BABYLON.Vector3(
const position = new BABYLON.Vector3(
-3.3,
shape.depth / 2 + CONFIG.Floating,
-2.0
);
// 旋转
field.rotation = CONFIG.FieldSlotRotation();
// 材质
const fieldMaterial = new BABYLON.StandardMaterial("fieldMaterial", scene);
fieldMaterial.diffuseColor = CONFIG.FieldColor();
field.material = fieldMaterial;
const rotation = CONFIG.FieldSlotRotation();
return (
<box
name="field"
width={shape.width}
height={shape.height}
depth={shape.depth}
position={position}
rotation={rotation}
>
<standardMaterial name="field-mat" diffuseColor={CONFIG.FieldColor()} />
</box>
);
};
export default Field;
......@@ -8,6 +8,7 @@ import Monsters from "./monsters_";
import CardModal from "./cardModal";
import HintNotification from "./hintNotification";
import Magics from "./magics_";
import Field from "./field_";
const NeosDuel = () => (
<>
......@@ -21,6 +22,7 @@ const NeosDuel = () => (
<Hands />
<Monsters />
<Magics />
<Field />
<Ground />
</Provider>
</Scene>
......
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