123456789101112131415161718192021222324252627 |
- import { _decorator, Component, Node, Vec2, Vec3 } from 'cc';
- import { ModulerBase } from './ModulerBase';
- import { MapMgr } from './MapMgr';
- import { CardMgr } from './CardMgr';
- import { TowerMgr } from './TowerMgr';
- const { ccclass, property } = _decorator;
- @ccclass('TouchMgr')
- export class TouchMgr extends ModulerBase {
- private _towerPos: Vec3 = null;
- init(): void{
- this.node.on(Node.EventType.TOUCH_START,(e)=>{
- const touchPos: Vec2 = e.getUILocation();
- const pos: Vec3 = this.getModuler(MapMgr).getCenterByPos(touchPos);
- if(this.getModuler(CardMgr).touchCard(touchPos)){
- this.getModuler(TowerMgr).creatTower(this._towerPos,1);
- return;
- }
- if(!this.getModuler(CardMgr).show(pos)){
- this._towerPos = pos;
- return;
- }
- })
- }
- }
|