Renderer/assets/Scenes/defaultLevel_2/scene.ts
austin 1f028aa924
Some checks failed
studiorailgun/Renderer/pipeline/head There was a failure building this commit
ui toolkit work
2024-07-20 12:30:09 -04:00

71 lines
1.9 KiB
TypeScript

import { engine } from "/Scripts/engine/engine-init";
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)
// engine.classes.simulation.static.setFramestep(0)
}
},
/**
* Move hook
*/
{
signal: "entityGroundMove",
callback: (entityId: number, newPos: Vector) => {
// console.log("Entity moved " + entityId + " to " + Vector.toString(newPos))
}
},
/**
* Storing an item in inventory
*/
{
signal: "itemPickup",
callback: (entityId: number, inWorldItemEntityId: number, inInventoryItemEntityId: number) => {
// console.log(entityId + ' picked up an item, destroying ' + inWorldItemEntityId + ' and creating ' + inInventoryItemEntityId)
engine.classes.simulation.static.setFramestep(0)
engine.classes.tutorialUtils.static.showTutorialHint(
"BasicNavigation",
true,
() => {
engine.classes.simulation.static.setFramestep(2)
}
)
}
},
]
}
/**
* The scene to export
*/
export default TestScene1