import * as RE from 'rogue-engine' import * as THREE from 'three' export default class GameLogic extends RE.Component { @RE.props.list.prefab() buildings: Array; placementMode: number = 3 focusPoint: THREE.Object3D | undefined awake() { } start() { for(let i = 0; i < 100; i++) { const newBuilding = this.buildings[Math.floor(3 * Math.random())].instantiate() const randomPosition = new THREE.Vector3(Math.floor(98 * Math.random()) - 49, 0.1,Math.floor(98 * Math.random()) - 49) newBuilding.position.copy(randomPosition) } this.focusPoint = RE.App.currentScene.getObjectByName("FocusPoint") } update() { // if(RE.Input.keyboard.getKeyDown("Digit1")) { // this.placementMode = 3 // } // if(RE.Input.keyboard.getKeyDown("Digit2")) { // this.placementMode = 0 // } // if(RE.Input.keyboard.getKeyDown("Digit3")) { // this.placementMode = 1 // } // if(RE.Input.keyboard.getKeyDown("Digit4")) { // this.placementMode = 2 // } // if(RE.Input.mouse.getButtonDown(0)) { // const targetSelector = RE.App.currentScene.getObjectByName("GridTarget") // if(!targetSelector) { // return // } // let newBuilding = this.buildings[this.placementMode].instantiate() // newBuilding.position.set(targetSelector.position.x, 0, targetSelector.position.z) // } } } RE.registerComponent(GameLogic);