public void UpdateTextMesh() { HexCoord hc = _CCtrl.GetComponent <HexCoord> (); string txt = hc._hex.CoordString(); _TxtMsh.text = txt; }
// 将当前正在操作的棋子取消 public bool CancelOperatingChess( out Hex coord, out int dir, out int campId) { CellObjCtrl newestCtrl = _StdChessSpawer.GetSpawningCellObjCtrl(); if (newestCtrl == null) { coord = new Hex(); dir = -1; campId = -1; return(false); } coord = newestCtrl.GetComponent <HexCoord> ()._hex; dir = newestCtrl.GetDir(); MiroV1ModelSetting msetting = CellObjCtrlUtils.GetModelSettingFromCtrl(newestCtrl); campId = _MiroMgr.GetIdOfMiroModelSetting(msetting); _StdChessSpawer.Cancel(); //_GridCtrl.ConfirmOccupiedCells (); //DisableAllChessOperation (); _GridCtrl.TurnDragRotatersOnEmptyPlacableCells(true); return(true); }
void OnMouseDown() { if (!enabled) { return; } if (!_AllEnable) { return; } HexCoord hc = _cctrl.GetComponent <HexCoord> (); if (hc != null) { //Debug.Log ("Click on: " + gameObject.name); _Click.Invoke(hc); } }
public Hex GetLastOperatedCCtrlHex() { Hex h = new Hex(int.MaxValue, 0, 0); if (_LastOperatedCCtrl != null) { HexCoord hc = _LastOperatedCCtrl.GetComponent <HexCoord> (); h = hc._hex; } return(h); }
public Hex GetHexOfModel(MiroModelV1 model) { if (_Model2Cell.ContainsKey(model)) { CellObjCtrl ctrl = _Model2Cell [model]; HexCoord hc = ctrl.GetComponent <HexCoord> (); Hex h = hc._hex; return(h); } else { return(new Hex(int.MaxValue, 0, 0)); } }
static void ConfigAbsorbingSrcFor(CellObjCtrl cCtrl) { int dirFwd = cCtrl.GetDir(); int dirBwd = (int)Mathf.Repeat((float)(cCtrl.GetDir() + 3), (float)6); if (cCtrl._TgtObj == null) { return; } MiroModelV1 model = cCtrl._TgtObj.GetComponent <MiroModelV1> (); HexCoord hc = cCtrl.GetComponent <HexCoord> (); Transform tfFwd = hc._Neighbors [dirFwd]; Transform tfBwd = hc._Neighbors [dirBwd]; model.SetFwdAbsorbingSrcTF(tfFwd); model.SetBwdAbsorbingSrcTF(tfBwd); }
override protected void _Calculate() { bool bCtrlling = CellObjCtrlUtils.IsControllingObj(_cellCtrl); if (!bCtrlling) { return; } HexCoord hc = _cellCtrl.GetComponent <HexCoord> (); MiroV1ModelSetting mSetThis = _cellCtrl._TgtObj.GetComponent <MiroV1ModelSetting> (); MiroModelV1 model = mSetThis.GetComponent <MiroModelV1> (); OperateFwdAnteller(hc, mSetThis, model); OperateBwdAnteller(hc, mSetThis, model); MiroV1PlacementMgr.ConfigAbsorbingSrcForTF(_cellCtrl.transform); }
public static bool IsControllingObj(CellObjCtrl cctrl) { if (cctrl == null) { return(false); } if (cctrl._TgtObj == null) { return(false); } HexCoord hc = cctrl.GetComponent <HexCoord> (); if (hc == null) { return(false); } return(true); }
private bool IsXPointToY(CellObjCtrl X, CellObjCtrl Y) { if (X == null || Y == null) { return(false); } HexCoord HA = X.GetComponent <HexCoord> (); HexCoord HB = Y.GetComponent <HexCoord> (); if (HA == null || HB == null) { return(false); } if (X._TgtObj == null) { return(false); } Transform ANbrTf = HA._Neighbors [X.GetDir()]; if (ANbrTf == null) { return(false); } CellObjCtrl NbrCtrl = ANbrTf.GetComponent <CellObjCtrl> (); if (NbrCtrl == Y) { return(true); } else { return(false); } }
public static CellObjCtrl GetNbCellObjCtrl(CellObjCtrl cctrl, int RelativeDir) { if (!IsInChessBoard(cctrl)) { return(null); } int FwdDir = cctrl.GetFwdDir(); int dir = FwdDir + RelativeDir; dir = (int)Mathf.Repeat((float)dir, 6.0f); HexCoord hc = cctrl.GetComponent <HexCoord> (); Transform NbTF = hc._Neighbors [dir]; if (NbTF == null) { return(null); } CellObjCtrl nbCtrl = NbTF.GetComponent <CellObjCtrl> (); return(nbCtrl); }
public static bool IsInChessBoard(CellObjCtrl cctrl) { HexCoord hc = cctrl.GetComponent <HexCoord> (); return(hc != null); }