private void DeteremineAttackablePieces() { Tile currentTile = _PieceAttacking.GetComponent <CharacterPiece>().CurrentTile; List <GameObject> adjTiles = currentTile.GetAdjTiles(); float radius = _PieceAttacking.transform.GetChild(0).GetComponent <Collider>().bounds.size.x / 4;// 1/4 the width of the model collider Vector3 pos; Collider[] hitColliders; // check each adjtile to see if piece occupies the tile foreach (GameObject adj in adjTiles) { pos = adj.transform.position; pos.y += _PieceAttacking.transform.GetChild(0).GetComponent <Collider>().bounds.size.y / 2; // half the hieght of the model collider hitColliders = Physics.OverlapSphere(pos, radius); // tile is blocked if (hitColliders.Length > 0) { // if piece on on other side then add to attackable if (hitColliders[0].transform.parent.GetComponent <CharacterPiece>().Stat.Side != GameManager.instance.CurrentSide) { AttackablePieces.Add(hitColliders[0].transform.parent.GetComponent <CharacterPiece>()); } } } // no pieces to attack if (AttackablePieces.Count == 0) { EndAttack(); } }
/// <summary> /// Display the current Rolled amount. /// </summary> private void DisplayRollAmount() { if (_HelpText) { String txt = "Total Rolled: "; txt += +_piece.GetComponent <Roll>().Movement; if (_piece.GetComponent <Roll>().modValue > 0) { txt += " (" + _piece.GetComponent <Roll>().baseMovement + " + " + _piece.GetComponent <Roll>().modValue + ")"; } _HelpText.text = txt; } else { Debug.Log("Error on DiplayRollAmount(): NO gameObject for Txt display."); } }