54 lines
943 B
TypeScript
54 lines
943 B
TypeScript
import GameUtil from "../core/GameUtil";
|
|
import { ELiveingType } from "../role/EEnum";
|
|
|
|
export default class LivingThing {
|
|
onlyid: number;
|
|
resid: number;
|
|
name: string;
|
|
mapid: number;
|
|
x: number;
|
|
y: number;
|
|
living_type: ELiveingType;
|
|
|
|
constructor() {
|
|
this.onlyid = GameUtil.getAutoAddId(); //唯一id
|
|
this.resid = 0;//资源id
|
|
this.name = '未知';
|
|
this.mapid = 0;
|
|
this.x = 0;
|
|
this.y = 0;
|
|
this.living_type = ELiveingType.UNKOWN;
|
|
}
|
|
|
|
toObj():any{
|
|
let result = {
|
|
onlyid: this.onlyid,
|
|
name: this.name,
|
|
mapid: this.mapid,
|
|
x: this.x,
|
|
y: this.y,
|
|
type: this.living_type,
|
|
}
|
|
return result;
|
|
}
|
|
|
|
move() {
|
|
}
|
|
|
|
isNpc(): boolean {
|
|
return this.living_type == ELiveingType.NPC;
|
|
}
|
|
|
|
isPlayer(): boolean {
|
|
return this.living_type == ELiveingType.PLAYER;
|
|
}
|
|
|
|
isMonster(): boolean {
|
|
return this.living_type == ELiveingType.MONSTER;
|
|
}
|
|
|
|
isPet(): boolean {
|
|
return this.living_type == ELiveingType.PET;
|
|
}
|
|
}
|