import bullet from "../game/bullet"; import { LQCollideSystem } from "../lq_collide_system/lq_collide_system"; import { UIList } from "./Core/Ui/UIDef"; import { UILayerNames, UILayers } from "./Core/Ui/UILayers"; import { UIMgr } from "./Core/Ui/UIMgr"; const {ccclass, property} = cc._decorator; @ccclass export default class Start extends cc.Component { /*===========================自动绑定组件开始===========================*/ /*自动生成*/ @property({type:cc.Node, displayName:""}) private $bulletLayer_node:cc.Node = null; /*自动生成*/ @property({type:cc.Node, displayName:""}) private $ui_node:cc.Node = null; /*===========================自动绑定组件结束===========================*/ /*===========================自动生成按钮事件开始==========================*/ /*===========================自动生成按钮事件结束==========================*/ @property(cc.Prefab) bulletPrefab:cc.Prefab = null; static inst: Start; protected onLoad(): void { Start.inst = this; // let node = new cc.Node() UIMgr.inst.setup(this.$ui_node, UILayerNames.length, UILayerNames); LQCollideSystem.is_enable = true; // UIMgr.inst.showUI(UIList.loading); // UIMgr.inst.showUI(UIList.loading); // setTimeout(()=>{ // UIMgr.inst.hideUI(UIList.loading); // }, 10000) } createPlayerBullet(pos: cc.Vec2){ let bulletNode = cc.instantiate(this.bulletPrefab) let bulletCpt = bulletNode.getComponent(bullet); let moveCpt = bulletCpt.getMoveCpt(); moveCpt.dirction = cc.v2(0,1); moveCpt.speed = 300; this.$bulletLayer_node.addChild(bulletNode); bulletNode.setPosition(pos); } }