init
This commit is contained in:
27
src/stores/gameStore.ts
Normal file
27
src/stores/gameStore.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
import { defineStore } from 'pinia'
|
||||
import { ref, shallowRef } from 'vue'
|
||||
import type { SceneNode, Choice } from '@engine/types'
|
||||
|
||||
export const useGameStore = defineStore('game', () => {
|
||||
const currentScene = shallowRef<SceneNode | null>(null)
|
||||
const choices = ref<Choice[]>([])
|
||||
const gameEnded = ref(false)
|
||||
|
||||
function setScene(scene: SceneNode) {
|
||||
currentScene.value = scene
|
||||
}
|
||||
|
||||
function setChoices(list: Choice[]) {
|
||||
choices.value = list
|
||||
}
|
||||
|
||||
function clearChoices() {
|
||||
choices.value = []
|
||||
}
|
||||
|
||||
function setGameEnded(val: boolean) {
|
||||
gameEnded.value = val
|
||||
}
|
||||
|
||||
return { currentScene, choices, gameEnded, setScene, setChoices, clearChoices, setGameEnded }
|
||||
})
|
||||
Reference in New Issue
Block a user