Renderer/assets/Scenes/defaultLevel_2/scene.ts
austin 893239c158
Some checks failed
studiorailgun/Renderer/pipeline/head There was a failure building this commit
hooks implementation
2024-07-16 17:55:28 -04:00

51 lines
1.0 KiB
TypeScript

import { Scene } from "/Scripts/types/scene";
import { Vector } from "/Scripts/types/spatial";
/**
* The main scene interface
*/
class TestScene1 extends Scene {
/**
* Called when the scene is created
* @param instanceId The scene instanceId
*/
onCreate = (instanceId: number) => {
console.log('Hello from the scene! My ID is ' + instanceId)
console.log(Object.keys(this))
}
/**
* All hooks for the scene
*/
hooks = [
/**
* Equip item hook
*/
{
signal: "equipItem",
callback: (entityId: number) => {
console.log("Item equipped to entity " + entityId)
}
},
/**
* Move hook
*/
{
signal: "entityGroundMove",
callback: (entityId: number, newPos: Vector) => {
console.log("Entity moved " + entityId + " to " + Vector.toString(newPos))
}
},
]
}
/**
* The scene to export
*/
export default TestScene1