| 
									
										
										
										
											2024-03-18 10:55:21 +08:00
										 |  |  | import { _decorator, Component, Node } from "cc"; | 
					
						
							|  |  |  | import { MapTileData, MapTileFactory, MapTileType } from "./MapTileData"; | 
					
						
							| 
									
										
										
										
											2024-03-19 18:03:50 +08:00
										 |  |  | const { ccclass } = _decorator; | 
					
						
							| 
									
										
										
										
											2024-03-18 10:55:21 +08:00
										 |  |  | 
 | 
					
						
							|  |  |  | @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() { | 
					
						
							| 
									
										
										
										
											2024-03-18 20:10:09 +08:00
										 |  |  |     const location = this._tileData.location; | 
					
						
							|  |  |  |     this.node.setPosition(location.x,location.y); | 
					
						
							| 
									
										
										
										
											2024-03-18 10:55:21 +08:00
										 |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   update(deltaTime: number) {} | 
					
						
							|  |  |  | } |