private View.Pieces.BasePiece CreatePiece(IPiece piece) { var pieceObject = Instantiate(mPiecePrefab, transform, true); pieceObject.transform.localScale = new Vector3(1, 1, 1); pieceObject.transform.localRotation = Quaternion.identity; var pieceType = _modelMapping[piece.GetType()]; var pieceView = (View.Pieces.BasePiece)pieceObject.AddComponent(pieceType); pieceView.viewManager = this; pieceView.Setup(piece.GetColor(), ColorSchema.PieceColors[piece.GetColor()]); return(pieceView); }
public CellState GetCellState(Vector2Int target, IPiece piece) { if (target.x < 0 || target.y > 7) { return(CellState.OutOfBounds); } if (target.x > 7 || target.y < 0) { return(CellState.OutOfBounds); } var targetPiece = mPieces[target.x, target.y]; if (targetPiece != null) { return(piece.GetColor() == targetPiece.GetColor() ? CellState.Friendly : CellState.Enemy); } return(CellState.Free); }