void OnTriggerEnter(Collider other) { // ..and if the game object we intersect has the tag 'Pick Up' assigned to it.. //Debug.Log("face:"+ other); if (other.gameObject == aim) { ChessController aimChess = other.gameObject.GetComponent <ChessController>(); aimChess.BeAttacked(atkAttr, fromObj); Destroy(this.gameObject); } }
void SearchAim() { aim = null; Debug.Log("SearchAim" + board); List <ChessController> chesses = board.chesses; foreach (ChessController chess in chesses) { if (chess && chess.gameObject && chess.team == enemyTeam && chess.state != ChessState.MANAGE) { aim = chess; break; } } }