public void CreatePiece( PlayerColor playerOwner, PieceType front, PieceType back, PieceSide side, int fileNum, int rankNum) { var piece = prefabsDictionary.Instantiate("Piece"); var pieceImpl = piece.GetComponent <PieceImpl>(); var pieceLocationMoveImpl = piece.GetComponent <PieceLocationMoveImpl>(); var pieceHighlightOwnerImpl = piece.GetComponent <PieceHighlightOwnerImpl>(); entityFactory.BuildEntity <PieceED>(piece.GetInstanceID(), piece.GetComponents <IImplementor>()); pieceImpl.Front = front; pieceImpl.Back = back; pieceImpl.PieceType = side == PieceSide.FRONT ? front : back; pieceImpl.Direction = DirectionService.CalcDirection(playerOwner); pieceHighlightOwnerImpl.PlayerColor = playerOwner; Vector2 location = CommonService.CalcTransformPosition(fileNum, rankNum); piece.transform.position = new Vector3(location.x, location.y, 1); pieceLocationMoveImpl.Location = new Vector2(fileNum, rankNum); pieceHighlightOwnerImpl.PlayChangeColor = true; }
private void CreateBoardTiles() { for (int rankNum = 0; rankNum < BoardConst.NUM_FILES_RANKS; rankNum++) { for (int fileNum = 0; fileNum < BoardConst.NUM_FILES_RANKS; ++fileNum) { CreateTile( CommonService.CalcTransformPosition(fileNum, rankNum), fileNum, rankNum); } } }