import { NpcRunner } from "./NpcRunner";

export class NpcControl{
    private static ins:NpcControl;
    //npc模型
    public m_npcmodel:Laya.Sprite3D;
    public m_npcrunner:NpcRunner;
   

    constructor(){
        NpcControl.ins = this;
    }
    public static get Instance():NpcControl{
        if(NpcControl.ins){
            return NpcControl.ins
        }
        else{
            return new NpcControl();
        }
    }
    Init(_npc:Laya.Sprite3D){
        this.m_npcmodel = _npc;
        let npcrunner = this.m_npcmodel.getComponent(NpcRunner) as NpcRunner;
        if(npcrunner){
            npcrunner.destroy();
        }
        this.m_npcrunner = this.m_npcmodel.addComponent(NpcRunner) as NpcRunner;
    }
}