public void HandleConfirm(Vector2 target) { BattleMapManager.BattleMapManager mapManager = BattleMapManager.BattleMapManager.getInstance(); if (TargetList.Count == 0) { if (mapManager.CheckIfHasUnits(target)) { TargetList.Add(target); GameUnit.GameUnit unit = BattleMapManager.BattleMapManager.getInstance().GetUnitsOnMapBlock(TargetList[0]); unit.GetComponent <ShowRange>().MarkMoveRange(); unit.GetComponent <ShowRange>().MarkAttackRange(); } } else if (TargetList.Count == 1) { if (mapManager.CheckIfHasUnits(target)) { //TargetList.Add(target); GameUnit.GameUnit unit1 = mapManager.GetUnitsOnMapBlock(TargetList[0]); //GameUnit.GameUnit unit2 = mapManager.GetUnitsOnMapBlock(TargetList[1])[0]; GameUnit.GameUnit unit2 = mapManager.GetUnitsOnMapBlock(target); UnitAttackCommand attackCommand = new UnitAttackCommand(unit1, unit2); if (attackCommand.Judge()) { //关闭染色 unit1.GetComponent <ShowRange>().CancleAttackRangeMark(); unit1.GetComponent <ShowRange>().CancleMoveRangeMark(); attackCommand.Excute(); TargetList.Clear(); } } else { //TargetList.Add(target); GameUnit.GameUnit unit1 = mapManager.GetUnitsOnMapBlock(TargetList[0]); Vector2 unit2 = target; UnitMoveCommand moveCommand = new UnitMoveCommand(unit1, unit2); if (moveCommand.Judge()) { //关闭染色 unit1.GetComponent <ShowRange>().CancleAttackRangeMark(); unit1.GetComponent <ShowRange>().CancleMoveRangeMark(); moveCommand.Excute(); TargetList.Clear(); } } } }
//处理地图块点击事件 public void OnPointerDown(PointerEventData eventData) { if (UnitManager.Instance.IsPickedUnit) { //检测到地图,可实例化棋子 if (!BattleMapManager.getInstance().WarZoneBelong(GetSelfPosition())) { return; } UnitManager.Instance.CouldInstantiation(true, this.transform); } /*GameObject go = */ //MapManager.getInstance().OnClickInstantiateUnit(); //go.transform.SetParent(this.transform); //go.transform.localScale = GetCoordinate(); //go.transform.localPosition = Vector3.zero; BattleMapManager.getInstance().curMapPos = GetSelfPosition(); Debug.Log(GetSelfPosition()); }
private void Awake() { instance = this; InitMap(); }
//隐藏战区 public void OnPointerExit(PointerEventData eventData) { BattleMapManager.getInstance().HideBattleZooe(GetSelfPosition()); }