20 lines
642 B
TypeScript
20 lines
642 B
TypeScript
import { Character } from '#entities/character'
|
|
import { CharacterService } from '#services/characterService'
|
|
|
|
class ZoneCharacter {
|
|
public readonly character: Character
|
|
public isMoving: boolean = false
|
|
public currentPath: Array<{ x: number; y: number }> | null = null
|
|
|
|
constructor(character: Character) {
|
|
this.character = character
|
|
}
|
|
|
|
public async savePosition() {
|
|
const characterService = new CharacterService()
|
|
await characterService.updateCharacterPosition(this.character.id, this.character.positionX, this.character.positionY, this.character.rotation, this.character.zone!.id)
|
|
}
|
|
}
|
|
|
|
export default ZoneCharacter
|