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 BuildTurnEntity() { var prefabsDictionary = new PrefabsDictionary(); var currentTurn = prefabsDictionary.Instantiate("Current Turn"); var currentTurnImpl = currentTurn.GetComponent <TurnImpl>(); entityFactory.BuildEntity <TurnED>(currentTurn.GetInstanceID(), currentTurn.GetComponents <IImplementor>()); currentTurnImpl.PlayerColor = PlayerColor.BLACK; }
private void CreateTile(Vector2 position, int fileNum, int rankNum) { var tile = prefabsDictionary.Instantiate("Board Tile"); var tileImpl = tile.GetComponent <TileImpl>(); entityFactory.BuildEntity <TileED>(tile.GetInstanceID(), tile.GetComponents <IImplementor>()); tile.transform.position = new Vector3(position.x, position.y, 0); tileImpl.Location = new Vector2(fileNum, rankNum); }
private void BuildTurnEntity() { var prefabsDictionary = new PrefabsDictionary(); var currentTurn = prefabsDictionary.Instantiate("Current Turn"); var currentTurnImpl = currentTurn.GetComponent <TurnImpl>(); entityFactory.BuildEntity <TurnED>(currentTurn.GetInstanceID(), currentTurn.GetComponents <IImplementor>()); currentTurnImpl.PlayerColor = PlayerColor.BLACK; currentTurnImpl.IsInitialArrangementInEffect = true; // TODO Later set based on reading from save game file or new game option }
public void CreateHandPiece(PlayerColor playerOwner, PieceType front, PieceType back, int num) { var handPiece = prefabsDictionary.Instantiate("Hand Piece"); var handPieceImpl = handPiece.GetComponent <HandPieceImpl>(); entityFactory.BuildEntity <HandPieceED>(handPiece.GetInstanceID(), handPiece.GetComponents <IImplementor>()); handPiece.name = playerOwner.ToString() + " Hand Piece " + front.ToString() + " " + back.ToString(); handPieceImpl.PlayerColor = playerOwner; handPieceImpl.Back = back; handPieceImpl.PieceType = front; // TODO Abstract out offset position numbers into BoardConst later -- once I have those numbers. // TODO Adjust transform.position based on, well, position of other hand pieces of that player Vector3 handPieceLocation; if (playerOwner == PlayerColor.BLACK) { handPieceLocation = BoardConst.HAND_PIECE_BLACK_OFFSET; handPieceLocation = new Vector3( handPieceLocation.x + BoardConst.HAND_PIECE_X_SPACE * (num % 7), handPieceLocation.y - BoardConst.HAND_PIECE_Y_SPACE * (num / 7), handPieceLocation.z ); } else { handPieceLocation = BoardConst.HAND_PIECE_WHITE_OFFSET; handPieceLocation = new Vector3( handPieceLocation.x + BoardConst.HAND_PIECE_X_SPACE * (num % 7), handPieceLocation.y + BoardConst.HAND_PIECE_Y_SPACE * (num / 7), handPieceLocation.z ); } handPiece.transform.position = handPieceLocation; }