Commit 33778310 authored by Chunchi Che's avatar Chunchi Che

add Cemetery component

parent adf8a0f9
Pipeline #18903 passed with stages
in 4 minutes and 34 seconds
import * as BABYLON from "@babylonjs/core"; import * as BABYLON from "@babylonjs/core";
import * as CONFIG from "../../config/ui"; import * as CONFIG from "../../config/ui";
export default (scene: BABYLON.Scene) => { const Cemetery = () => {
// 墓地
const shape = CONFIG.CemeterySlotShape(); const shape = CONFIG.CemeterySlotShape();
const cemetery = BABYLON.MeshBuilder.CreateBox("cemetery", shape); const position = new BABYLON.Vector3(
// 位置
cemetery.position = new BABYLON.Vector3(
3.2, 3.2,
shape.depth / 2 + CONFIG.Floating, shape.depth / 2 + CONFIG.Floating,
-2.0 -2.0
); );
// 旋转 const rotation = CONFIG.CemeterySlotRotation();
cemetery.rotation = CONFIG.CemeterySlotRotation();
// 材质 return (
const cemeteryMaterial = new BABYLON.StandardMaterial( <box
"cemeteryMaterial", name="cemetery"
scene width={shape.width}
height={shape.height}
depth={shape.depth}
position={position}
rotation={rotation}
>
<standardMaterial
name="cemetery-mat"
diffuseColor={CONFIG.CemeteryColor()}
/>
</box>
); );
cemeteryMaterial.diffuseColor = CONFIG.CemeteryColor();
cemetery.material = cemeteryMaterial;
}; };
export default Cemetery;
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