You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

26 lines
717 B

import { gameManager } from "@/Game";
import { IPointData } from "pixi.js";
class Position {
static instance: Position = null
private constructor() { }
static getInstance() {
if (Position.instance == null) {
Position.instance = new Position
}
return Position.instance
}
get(xType: "center", yType: "center", offset: Partial<IPointData>): IPointData {
let x, y
if (xType === 'center') {
x = gameManager.getInfo().width / 2 + (offset.x ?? 0)
}
if (yType === 'center') {
y = gameManager.getInfo().height / 2 + (offset.y ?? 0)
}
return { x, y }
}
}
export default Position.getInstance()