{
  "code": "import { LevelController } from \"../Game/LevelController\";\r\nimport Dictionary from \"../Util/Dictionary\";\r\nimport { GamePool } from \"../Game/GamePool\";\r\nimport { MainRoleManager } from \"./MainRoleManager\";\r\nimport { MateManager } from \"./MateManager\";\r\nimport { Opponent } from \"../Game/Opponent\";\r\nimport { GameManager } from \"../Game/GameManager\";\r\nimport { MouseEvent } from \"../Game/MouseEvent\";\r\nvar Sprite = Laya.Sprite;\r\nexport class RoleManager {\r\n    constructor() {\r\n        this.frameCount = 10;\r\n        this.enemyDic = new Dictionary();\r\n    }\r\n    static get Instance() {\r\n        return this.instance || (this.instance = new RoleManager());\r\n    }\r\n    Create(hp, texture) {\r\n        let e = GamePool.Instance.GetModel(GamePool.modeltype.Enemy);\r\n        if (!e)\r\n            return;\r\n        MainRoleManager.Instance.playerContainer.addChild(e);\r\n        e.transform.position = this.startPos.clone();\r\n        let ps = e.getComponent(Opponent);\r\n        if (!ps)\r\n            ps = e.addComponent(Opponent);\r\n        let sp = this.GetTar();\r\n        ps.InitModel(sp, hp, texture);\r\n        this.enemyDic.set(e.id, ps);\r\n    }\r\n    CheckGameOver() {\r\n        if (this.enemyDic.size == 0) {\r\n            MouseEvent.Instance.OnClickUp();\r\n            MainRoleManager.Instance.CreateOver();\r\n            GameManager.Instance.Congratulate();\r\n        }\r\n    }\r\n    GetOpponent() {\r\n        for (const key in this.enemyDic.container) {\r\n            const element = this.enemyDic.get(key);\r\n            return element.selfobj;\r\n        }\r\n        return null;\r\n    }\r\n    Reset() {\r\n        let arr = [];\r\n        for (const key in this.enemyDic.container) {\r\n            arr.push(key);\r\n        }\r\n        if (arr.length > 0) {\r\n            for (let index = 0; index < arr.length; index++) {\r\n                const element = arr[index];\r\n                let s = this.enemyDic.get(element);\r\n                if (s)\r\n                    s.Recovery();\r\n            }\r\n        }\r\n    }\r\n    CreateOpponent(startPos) {\r\n        this.startPos = startPos;\r\n        let count = LevelController.Instance._level.enemy;\r\n        let hp = LevelController.Instance._level.enemy_hp;\r\n        let texture = LevelController.Instance._level.enemy_cloth;\r\n        for (let index = 0; index < count; index++) {\r\n            let a = index;\r\n            Laya.timer.frameOnce(a * this.frameCount, this, this.Create, [hp, texture], false);\r\n        }\r\n    }\r\n    createCoralRect() {\r\n        var coralRect = new Sprite();\r\n        coralRect.graphics.drawRect(0, 0, Laya.stage.width, Laya.stage.height / 2, \"#FF7F50\");\r\n        coralRect.name = \"珊瑚色容器\";\r\n        coralRect.size(Laya.stage.width, Laya.stage.height / 2);\r\n        Laya.stage.addChild(coralRect);\r\n    }\r\n    createDeepSkyblueRect() {\r\n        var deepSkyblueRect = new Sprite();\r\n        deepSkyblueRect.graphics.drawRect(0, 0, 100, 100, \"#00BFFF\");\r\n        deepSkyblueRect.name = \"天蓝色矩形\";\r\n        deepSkyblueRect.size(100, 100);\r\n        deepSkyblueRect.pos(10, 10);\r\n        Laya.stage.addChild(deepSkyblueRect);\r\n    }\r\n    GetTar() {\r\n        let p = MainRoleManager.Instance.NearIsdead();\r\n        if (!p) {\r\n            if (Math.random() > 0.5) {\r\n                return MainRoleManager.Instance.playerScript.body;\r\n            }\r\n            else {\r\n                let s = MateManager.Instance.GetSprite();\r\n                if (!s)\r\n                    return MainRoleManager.Instance.playerScript.body;\r\n                else\r\n                    return s;\r\n            }\r\n        }\r\n        else {\r\n            let s = MateManager.Instance.GetSprite();\r\n            if (!s)\r\n                return null;\r\n            else\r\n                return s;\r\n        }\r\n    }\r\n    RecoverEnemy(sp) {\r\n        this.enemyDic.delete(sp.id);\r\n    }\r\n}\r\n//# sourceMappingURL=RoleManager.js.map",
  "references": [
    "C:/Users/Administrator/Desktop/gungang/src/Game/LevelController.ts",
    "C:/Users/Administrator/Desktop/gungang/src/Util/Dictionary.ts",
    "C:/Users/Administrator/Desktop/gungang/src/Game/GamePool.ts",
    "C:/Users/Administrator/Desktop/gungang/src/Manager/MainRoleManager.ts",
    "C:/Users/Administrator/Desktop/gungang/src/Manager/MateManager.ts",
    "C:/Users/Administrator/Desktop/gungang/src/Game/Opponent.ts",
    "C:/Users/Administrator/Desktop/gungang/src/Game/GameManager.ts",
    "C:/Users/Administrator/Desktop/gungang/src/Manager/PlaneManager.ts",
    "C:/Users/Administrator/Desktop/gungang/src/Game/MouseEvent.ts"
  ],
  "map": "{\"version\":3,\"file\":\"RoleManager.js\",\"sourceRoot\":\"\",\"sources\":[\"../../../src/Manager/RoleManager.ts\"],\"names\":[],\"mappings\":\"AAGA,OAAO,EAAC,eAAe,EAAC,MAAM,yBAAyB,CAAC;AACxD,OAAO,UAAU,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAY,MAAM,kBAAkB,CAAC;AACtD,OAAO,EAAC,eAAe,EAAC,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAC,WAAW,EAAC,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAC,WAAW,EAAC,MAAM,qBAAqB,CAAC;AAEhD,OAAO,EAAC,UAAU,EAAC,MAAM,oBAAoB,CAAC;AAE9C,IAAO,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC;AAO5B,MAAM,OAAQ,WAAW;IAKrB;QASQ,eAAU,GAAG,EAAE,CAAC;QARpB,IAAI,CAAC,QAAQ,GAAG,IAAI,UAAU,EAAE,CAAC;IACrC,CAAC;IALM,MAAM,KAAK,QAAQ;QACtB,OAAO,IAAI,CAAC,QAAQ,IAAI,CAAC,IAAI,CAAC,QAAQ,GAAG,IAAI,WAAW,EAAE,CAAC,CAAC;IAChE,CAAC;IAYD,MAAM,CAAC,EAAE,EAAE,OAAO;QACd,IAAI,CAAC,GAAG,QAAQ,CAAC,QAAQ,CAAC,QAAQ,CAAC,QAAQ,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;QAC7D,IAAI,CAAC,CAAC;YAAE,OAAO;QACf,eAAe,CAAC,QAAQ,CAAC,eAAe,CAAC,QAAQ,CAAC,CAAC,CAAC,C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