39 lines
		
	
	
		
			992 B
		
	
	
	
		
			TypeScript
		
	
	
	
			
		
		
	
	
			39 lines
		
	
	
		
			992 B
		
	
	
	
		
			TypeScript
		
	
	
	
| import { _decorator, Component, Node } from "cc";
 | |
| import { MapTileData, MapTileFactory, MapTileType } from "./MapTileData";
 | |
| const { ccclass } = _decorator;
 | |
| 
 | |
| @ccclass("MapTileController")
 | |
| export class MapTileController extends Component {
 | |
| 
 | |
|   /// 地块数据
 | |
|   private _tileData: MapTileData;
 | |
|   get tileData(){ return this._tileData; };
 | |
| 
 | |
|   /// 地块类型
 | |
|   private _tileType: MapTileType;
 | |
|   set tileType(newType: MapTileType){
 | |
|     this._tileType = newType;
 | |
|     this._tileData = MapTileFactory.getData(newType as MapTileType);
 | |
|   };
 | |
|   get tileType(){ return this._tileType; };
 | |
| 
 | |
| 
 | |
|   /// 地块占领状态(是谁占领的,)
 | |
|   private occupState: string;
 | |
| 
 | |
|   /// 占领等级
 | |
|   private occupyLevel: 0 | 1 | 2 | 3;
 | |
| 
 | |
|   /// 决斗场等级
 | |
|   private fightLevel: 2 | 4 | 8;
 | |
| 
 | |
|   /// 进入选择地下城状态,海上列车选择,决斗场选择
 | |
| 
 | |
|   start() {
 | |
|     const location = this._tileData.location;
 | |
|     this.node.setPosition(location.x,location.y);
 | |
|   }
 | |
| 
 | |
|   update(deltaTime: number) {}
 | |
| }
 |