public void OnHexBoardUp(HexField hex) { Debug.Log("Hex Up coord:" + hex.GetCoordinates() + " position:" + hex.transform.position); hex.ShowColor(Color.green); List <HexField> list = boardManager.GetNeigbors(hex.GetCoordinates(), 2); foreach (HexField hex2 in list) { hex2.ShowColor(Color.yellow); } boardManager.AnimationGoToHex(hex, 5, false); }
/** * przekazujemy hex który jest pusty. wtedy metoda sprawdza sąsiednie, jeśli sąsiedni jest pusty i zakrtyty to rekurencyjnie wywołuje tą metodę jeszcze raz */ private void ProccessEmpty(HexField hex) { Field field = (Field)hex.hexLogic; if (field.top.enabled == true && field.flag.enabled == false) { field.top.enabled = false; List <HexField> listNeigbors = boardManager.GetNeigbors(hex.GetCoordinates()); foreach (HexField neigborHex in listNeigbors) { if (field.type == Field.TypeNames.EMPTY) { ProccessEmpty(neigborHex); } } } }